javascript - t梳反应原生表单选择器无法显示选择的值
问题描述
我有一个反应原生的 ^0.64.0 应用程序。我在 iOS 上运行 t-comb 包import t from 'tcomb-form-native';
并将此代码用于表单:
const Form = t.form.Form;
<Form ref={this.formRef} type={SetupOne} options={options} value={this.state.value}/>
在选项道具中,我有以下内容:
let options = {
fields: {
terrain: {
textColor: 'white',
selectTextOnFocus: 'white',
optionTextColor: 'white',
factory: t.form.Select,
help: 'Call it on which terrain you ride this setup',
nullOption: {value: '', text: 'Choose the terrain'},
options: terrains,
stylesheet: stylesheet,
title: 'Choose the terrain',
itemStyle: {
color: 'white',
},
},
stylesheet: formStyles,
}
}
我的地形变量是
let terrains = [
{ value: 'bikepark', text: 'Bikepark' },
{ value: 'trail', text: 'Trail' }
];
我想在选择字段中显示所选值:
我怎样才能做到这一点?
解决方案
推荐阅读
- python - 在 Python 中,给定一个行号,我如何知道它属于哪个范围?
- c++ - 获取包含非英文字符的文档路径时出现问题
- python - 将多行 bash 脚本转换为单行
- html - 如果我将包装器设置为向左浮动,则内部元素的绝对定位消失,宽度和高度为 0
- python - 使用 Django 在 html 中显示一个 csv pandas 文件
- swift - 当传入视图的 ObservedObject 更新时,SwiftUI 不会更新?
- python - Python - Tkinter 检查此标签是否为空
- python - 绘制和解释 TensorFlow 结果
- reactjs - 如何检查我的反应钩子条件
- html - Sapper 在彼此下方加载页面