我在ScrollView中有一个TextInput。
当TextInput处于焦点时,滚动不起作用。此问题仅影响Android。
设置
<ScrollView keyboardShouldPersistTaps="always"
结合下面的textInout组件(我为文本输入创建的自定义组件来解决这个问题)解决了我的问题:
<TouchableOpacity
activeOpacity={1}
onPress={()=>this.input.focus()}>
<View pointerEvents="none"
<TextInput
ref = {(input) => this.input = input}
/>
</View>
</TouchableOpacity>
在scrollView中使用keyboardShouldPersistTaps
<ScrollView keyboardShouldPersistTaps="handled">
它解决了你的问题
在这里查看文档https://facebook.github.io/react-native/docs/scrollview.html#keyboarddismissmode
对我来说真正重要的是添加:
机器人:windowSoftInputMode = “adjustResize”
在AndroidManifest.xml中以便关注textInput