[英]React Native - TouchableOpacity and TextInput is not working inside ScrollView
I have a ScrollView
which has TouchableOpacity
and TextInput
inside. 我有一个
ScrollView
,里面有TouchableOpacity
和TextInput
。 When I press on them, nothing happens. 当我按它们时,什么也没发生。
I found the solution for TouchableOpacity
and it was to add rejectResponderTermination={true}
and it worked. 我找到了解决方案
TouchableOpacity
,这是增加rejectResponderTermination={true}
和它的工作。 For example: 例如:
<TouchableOpacity
onPress={cameraHandler}
rejectResponderTermination={true}
>
However this does not work for TextInput. 但是,这不适用于TextInput。
<TextInput
onChangeText={updateText}
value={value.text}
rejectResponderTermination={true}
/>
I would like to use the functionality of rejectResponderTermination
in TextInput
. 我想在
TextInput
使用rejectResponderTermination
的功能。 Any suggestions would be much appreciated. 任何建议将不胜感激。
rejectResponderTermination
is not a prop of TextInput
. rejectResponderTermination
不是TextInput
。 Try removing it. 尝试将其删除。
<TextInput
onChangeText={updateText}
value={value.text}
/>
A list of props can be found in the official documentation. 道具列表可以在官方文档中找到。
If you still want the functionality of rejectResponderTermination
, currently you would have to build your own. 如果您仍然需要
rejectResponderTermination
的功能,则当前必须构建自己的功能。 This SlideTextInput is an example of how you would do it. 此SlideTextInput是如何执行此操作的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.