
Exploring Alternative Emulators for React Native Development
January 20, 2024
1 min

setGestureState Boolean false. trueonPanBegin({ originX, originY }) Function onPan({ absoluteChangeX, absoluteChangeY, changeX, changeY }) Function onPanEnd() Function panDecoratorStyle Object resetPan Boolean true is passed, it will reset the state of the panning decorator. This can be useful if you want to reset the absolute change values, since these stay stored until you reset them.setGestureState Boolean false.horizontal Boolean falsevertical Boolean falseleft Boolean falseright Boolean falseup Boolean falseup Boolean falsecontinuous Boolean true, then you will receive an update each time the touch moves. If false you will only receive a single notification about the touch. trueinitialVelocityThreshold Number 0.7verticalThreshold Number 10 horizontalThreshold Number 10 onSwipeBegin({ direction, distance, velocity }) FunctiononSwipe({ direction, distance, velocity }) Function continuous is true.onSwipeEnd({ direction }) Function swipeDecoratorStyle Object npm i react-native-gesture-recognizers
import React, { useRef, useState } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { RotationGestureHandler } from 'react-native-gesture-handler';
export default function App() {
const rotationRef = useRef(null);
const [rotation, setRotation] = useState(0);
const onRotationGestureEvent = ({ nativeEvent }) => {
setRotation(nativeEvent.rotation);
};
return (
<View style={styles.container}>
<RotationGestureHandler
ref={rotationRef}
onGestureEvent={onRotationGestureEvent}
onHandlerStateChange={({ nativeEvent }) => {
if (nativeEvent.oldState === 4) {
setRotation(11);
}
}}
>
<View style={[styles.box, { transform: [{ rotate: `${rotation}deg` }] }]}>
<Text style={styles.text}>Rotate Me</Text>
</View>
</RotationGestureHandler>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
box: {
width: 200,
height: 200,
backgroundColor: '#FFC107',
justifyContent: 'center',
alignItems: 'center',
},
text: {
color: '#FFF',
fontSize: 24,
fontWeight: 'bold',
},
});
Coming Soon…






Quick Links
Legal Stuff