【发布时间】:2018-09-12 16:31:10
【问题描述】:
我的组件中有这个表单:
this.state.customFieldsArray.length > 0 &&
(
<Form
ref="customForm"
type={this.customForm}
options={this.customFormOptions}
/>
)}
我想在单击按钮时向表单添加更多选项(以便呈现更多字段)。 这是处理按钮点击的方法:
addCustomField = () => {
let newFieldName = this.state.customFieldLabel;
let newField = { newFieldName: "" };
this.customFormOptions.fields[newFieldName] = {
label: newFieldName
};
tempCustomFieldsArray.push(newField);
this.setState({
customFieldsArray: tempCustomFieldsArray
});
};
我试过了,但是没用。
【问题讨论】:
标签: javascript react-native tcomb-form-native