React native React Native中的指针事件是什么

React native React Native中的指针事件是什么,react-native,React Native,我正在经历 在文件中,他们提到 Controls whether the View can be the target of touch events. • 'auto': The View can be the target of touch events. • 'none': The View is never the target of touch events. • 'box-none': The View is never the target of touch event

我正在经历

在文件中,他们提到

Controls whether the View can be the target of touch events.
•   'auto': The View can be the target of touch events.
•   'none': The View is never the target of touch events.
•   'box-none': The View is never the target of touch events but it's subviews can be. It behaves like if the view had the following classes in CSS:
我在这儿 能够从属性
none
中理解没有触摸事件会起作用,即touchableOpacity(和其他触摸事件)?对吗

但是从YouTube上的以下教程视频


作者似乎正在使用它来禁用textInput之类的事件,而不是将其用于TouchableOpacty之类的事件

pointerEvents
设置为
none
时,您将禁用视图子对象的所有触摸事件。这适用于所有触摸屏,但也适用于输入等。 在视频中,作者使用它来防止TextInput聚焦,但他保持TouchableOpacity启用以触发动画。(参见下面的示例)

示例:

在这里,我禁用了TextInput,但我保持了Touchable的活动状态:

<View>
<TouchableOpacity>
  <View pointerEvents="none">
    <TextInput ... /> 
  </View>
</TouchableOpacity>
</View>


如果我将
pointerEvents=“none”
添加到根视图,Touchable和TextInput都将被停用

pointerEvents
设置为
none
时,您将禁用视图子对象的所有触摸事件。这适用于所有触摸屏,但也适用于输入等。 在视频中,作者使用它来防止TextInput聚焦,但他保持TouchableOpacity启用以触发动画。(参见下面的示例)

示例:

在这里,我禁用了TextInput,但我保持了Touchable的活动状态:

<View>
<TouchableOpacity>
  <View pointerEvents="none">
    <TextInput ... /> 
  </View>
</TouchableOpacity>
</View>

如果我将
pointerEvents=“none”
添加到根视图,Touchable和TextInput都将被停用