"react": "16.8.3",
"react-native": "0.59.1",
I just made a simple encapsulation of PanResponder.
// EventifyimportReactfrom'react';import{View,PanResponder}from'react-native';exportdefaultfunctionEventify(props){const{ onTouchStart, onTouching, onTouchEnd }=props;constresponder=PanResponder.create({// ...onPanResponderGrant: ()=>onTouchStart(),onPanResponderMove: ()=>onTouching(),onPanResponderRelease: (_,gestureState)=>{console.log('onPanResponderRelease');onTouchEnd(gestureState);},});return(<View{...props}{...responder.panHandlers}>{props.children}</View>);}importReact,{Component}from'react';import{View}from'react-native';importEventifyfrom'../components/Eventify';exportdefaultclassextendsComponent{onTouchStart=(event)=>{console.log('onTouchStart');}onTouching=(event)=>{console.log('onTouching');}onTouchEnd=(event)=>{console.log('onTouchEnd');}render(){return(<EventifyonTouchStart={this.onTouchStart}onTouching={this.onTouching}onTouchEnd={this.onTouchEnd}><Viewstyle={styles.view}></View></Eventify>)}}conststyles=rnc`view { width: 375; height: 200; background-color: #ddd;}`;When I tap the Eventify component, I got the following logs:
onTouchStart Demo.js:9
onTouchStart Demo.js:9
onPanResponderRelease Event.js:16
onTouchEnd Demo.js:15
onTouchEnd Demo.js:15
The method onTouchStart and onTouchEnd has two execution. And the method onPanResponderRelease just once execution.
It's troubling me.
"react": "16.8.3",
"react-native": "0.59.1",
I just made a simple encapsulation of PanResponder.
When I tap the Eventify component, I got the following logs:
The method
onTouchStartandonTouchEndhas two execution. And the methodonPanResponderReleasejust once execution.It's troubling me.