无法从一个TextInput轻按到另一个 [英] Can't tap from one TextInput to another
问题描述
当我专注于一个TextInput
时,点击另一个TextInput
字段并不能达到我的期望(将 focus 更改为该TextInput
).
When I'm focused in one TextInput
, tapping in another TextInput
field doesn't do what I'd expect (change focus to that TextInput
).
相反,它只是模糊当前的TextInput
,需要第二次点击来聚焦下一个TextInput
.
Instead, it simply blurs the current TextInput
, requiring a second tap to focus the next TextInput
.
有什么方法可以做到吗,或者这是 React Native 的当前缺点吗?
Is there some way to do this, or is this a current shortcoming of React Native?
示例代码:
class MyTest extends Component {
render() {
return (
<ScrollView style={styles.container}>
<View>
<TextInput style={styles.textInput} />
<TextInput style={styles.textInput} />
</View>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#ddd',
paddingTop: 64
},
textInput: {
backgroundColor: '#fff',
borderColor: '#000',
borderWidth: 1,
height: 46,
paddingLeft: 10
}
});
结果是,当输入字段位于ScrollView内时,它们的行为如上所述(您不能仅从一个字段点击到另一个字段).我尝试将TextInputs包装在View中以解决此问题,但这没有用.
Turns out, when the input fields are within a ScrollView, they behave as I described above (you can't just tap from one field to the other). I tried wrapping the TextInputs in a View to remedy this, but it didn't work.