我看不到任何内置方法可以告诉您用户最近是否以本机操作触摸了屏幕。无论如何,您可以跟踪自用户触摸屏幕以来已经有多长时间了。
答案 0 :(得分:1)
PanResponder
this._panResponder = PanResponder.create({
onMoveShouldSetResponderCapture: () => true,
onMoveShouldSetPanResponderCapture: () => true,
// Initially, set the Y position offset when touch start
onPanResponderGrant: (e, gestureState) => {
this.setState({
offset: e.nativeEvent.pageY,
isDividerClicked: true
})
},
// When we drag the divider, set the bottomHeight (component state) again.
onPanResponderMove: (e, gestureState) => {
this.setState({
bottomHeight : gestureState.moveY > (this.state.deviceHeight - 40) ? 40 : this.state.deviceHeight - gestureState.moveY,
offset: e.nativeEvent.pageY
})
},
onPanResponderRelease: (e, gestureState) => {
// Do something here for the touch end event
this.setState({
offset: e.nativeEvent.pageY,
isDividerClicked: false
})
}
});