keske / react-native-easy-gestures

React Native Gestures. Support: Drag, Scale and Rotate a Component.
MIT License
174 stars 61 forks source link

add reset to original position method #31

Closed fariswd closed 5 years ago

fariswd commented 6 years ago

Hi,

I do research for my project something like joystick / nipplejs on react native and your library shows up. but there is no reset to original position method. so i tweak a little bit.

there is how to use reset

<View style={{width: 100, height: 100, borderRadius: 125, backgroundColor: 'lightsalmon', justifyContent: 'center', alignItems: 'center'}}>
  <Gestures
    ref={ref => this.gestures = ref}
    onEnd={(event, styles) => {
      console.log(styles)
      this.gestures.reset()
    }}>
    <View style={{width: 30, height: 30, borderRadius: 20, backgroundColor: 'coral'}}/>
  </Gestures>
</View>

nipple

Thanks.