当焦点textinput响应本机时,scrollview无法滚动 [英] scrollview can't scroll when focus textinput react native

查看:146
本文介绍了当焦点textinput响应本机时,scrollview无法滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ScrollView中有一个TextInput.

I have a TextInput inside a ScrollView.

当TextInput对准焦点时,滚动无法正常工作.此问题仅影响Android.

The scroll isn't working when the TextInput is on focus. This problem is only affecting Android.

推荐答案

设置

<ScrollView keyboardShouldPersistTaps="always"

结合下面的textInput组件(我为文本输入创建的自定义组件来解决此问题)解决了我的问题:

in combination with the textInput component below (custom component that i created for text inputs to solve this issue) solved my problem:

<TouchableOpacity
     activeOpacity={1}
     onPress={()=>this.input.focus()}>
     <View pointerEvents="none"
           <TextInput
              ref = {(input) => this.input = input}
           />
     </View>
</TouchableOpacity>

这篇关于当焦点textinput响应本机时,scrollview无法滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆