Skip to content

Commit 214663f

Browse files
authored
[macOS] Fix rotation (#3122)
## Description Turns out that rotation on macOS works in opposite direction comparing to other platforms. This PR fixes that behavior. ## Test plan <details> <summary>Tested on the following code (check `rotation` value in event)</summary> ```tsx import React from 'react'; import { StyleSheet, View } from 'react-native'; import { Gesture, GestureDetector } from 'react-native-gesture-handler'; export default function EmptyExample() { const g = Gesture.Rotation().onChange(console.log); return ( <View style={styles.container}> <GestureDetector gesture={g}> <View style={{ width: 300, height: 300, backgroundColor: 'red' }} /> </GestureDetector> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, }); ``` </details>
1 parent 5b41fb1 commit 214663f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apple/Handlers/RNRotationHandler.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ - (instancetype)initWithTag:(NSNumber *)tag
149149
#if TARGET_OS_OSX
150150
- (RNGestureHandlerEventExtraData *)eventExtraData:(NSRotationGestureRecognizer *)recognizer
151151
{
152-
return [RNGestureHandlerEventExtraData forRotation:recognizer.rotation
152+
return [RNGestureHandlerEventExtraData forRotation:-recognizer.rotation
153153
withAnchorPoint:[recognizer locationInView:recognizer.view]
154154
withVelocity:((RNBetterRotationRecognizer *)recognizer).velocity
155155
withNumberOfTouches:2

0 commit comments

Comments
 (0)