RN中使用输入框的正确姿势

renderItem({item, index}) {
let defaultTxt = this.state.txtDic[index];
ref={'txt' + index}
style={{flex: 1, borderBottomWidth: 2}}
onChangeText={this.inputChanged.bind(this, index)}
value={defaultTxt}
/>
}
inputChanged(index, text) {
let pDic = this.state.txtDic;
pDic[index] = text;
this.setState({
txtDic: pDic
});
}

你可能感兴趣的:(RN中使用输入框的正确姿势)