假设我有3个视图,其中包含return try URLEncoding.default.encode(request, with: parameters as! Parameters)
。
return try JSONEncoding.default.encode(request, with: parameters)
通知TextInput
,其中<View style={styles.row}>
<TextInput
ref={'cell_'+i}
maxLength={1}
spellCheck={false}
style={styles.chewy}
onKeyPress={this._onInputFilled} />
</View>
<View style={styles.row}>
<TextInput
ref={'cell_'+i}
maxLength={1}
spellCheck={false}
style={styles.chewy}
onKeyPress={this._onInputFilled} />
</View>
<View style={styles.row}>
<TextInput
ref={'cell_'+i}
maxLength={1}
spellCheck={false}
style={styles.chewy}
onKeyPress={this._onInputFilled} />
</View>
等于0.2。现在,当我在ref={'cell_'+i}
中键入一个字符时,如何聚焦(移动光标)到下一个TextInput即i
?
答案 0 :(得分:0)
尝试此代码:
<View style={styles.row}>
<TextInput
ref={'cell_'+i}
maxLength={1}
spellCheck={false}
style={styles.chewy}
onKeyPress={this._onInputFilled}
onSubmitEditing={() => this.focusNextField('cell_' + (i+1))}
/>
</View>
<View style={styles.row}>
<TextInput
ref={'cell_'+i}
maxLength={1}
spellCheck={false}
style={styles.chewy}
onKeyPress={this._onInputFilled}
onSubmitEditing={() => this.focusNextField('cell_' + (i+1))}
/>
</View>
<View style={styles.row}>
<TextInput
ref={'cell_'+i}
maxLength={1}
spellCheck={false}
style={styles.chewy}
onKeyPress={this._onInputFilled}
/>
</View>
onSubmitEditing:
focusNextField = nextField => {
this.refs[nextField].focus();
};