[英]React Native: panresponder native event identifier undefined
I have a view 我有一个观点
<View style={styles.container} id={'time2'}>
<Text>hello</Text>
</View>
and onComponentWillMount, I have a pan handler (inside PanResponder.create) 和onComponentWillMount,我有一个平移处理程序(在PanResponder.create内部)
onPanResponderGrant: (evt, gestureState) => {
console.log('identifier', evt.identifier);
}
but when I press the view, the identifier gets printed out as undefined. 但是当我按下视图时,标识符将被打印为未定义。 Target is also undefined.
目标也未定义。 How do I get the id of my view to print out?
如何获取要打印的视图ID?
You have to access the identifier from the nativeEvent property of the evt: 您必须从evt的nativeEvent属性访问标识符:
onPanResponderGrant: (evt, gestureState) => {
console.log('identifier', evt.nativeEvent.identifier);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.