-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Bind SharedValues
in handler config
#3658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m-bert
commented
Aug 6, 2025
packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
j-piasecki
requested changes
Aug 8, 2025
...e-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
j-piasecki
reviewed
Aug 19, 2025
packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/hooks/useGesture.ts
Outdated
Show resolved
Hide resolved
j-piasecki
approved these changes
Aug 21, 2025
akwasniewski
added a commit
that referenced
this pull request
Aug 27, 2025
## Description This PR changes how config is handled on web, following #3658 it separates update and set functionality, which allows passing only relevant, changed fields to update, as opposed to the entire config. Moreover it removes the config field from `GestureHandler` - adds necessary fields as class fields, this mimics how config is handled on iOS / Android and simplifies the code (previously some fields were both both config and class fields). ## Test plan The update functionality was tested on the following code. ```ts import * as React from 'react'; import { Animated, Button } from 'react-native'; import { useSharedValue } from 'react-native-reanimated'; import { GestureHandlerRootView, NativeDetector, useGesture, } from 'react-native-gesture-handler'; export default function App() { const [visible, setVisible] = React.useState(true); const taps = useSharedValue(2); const gesture = useGesture('TapGestureHandler', { onEnd: () => { console.log('Tap detected. Required number of taps:', taps.value); taps.set(taps.value + 1); }, numberOfTaps: taps, }); return ( <GestureHandlerRootView style={{ flex: 1, backgroundColor: 'white', paddingTop: 8 }}> <Button title="Toggle visibility" onPress={() => { setVisible(!visible); }} /> {visible && ( <NativeDetector gesture={gesture}> <Animated.View style={[ { width: 150, height: 150, backgroundColor: 'blue', opacity: 0.5, borderWidth: 10, borderColor: 'green', marginTop: 20, marginLeft: 40, }, ]} /> </NativeDetector> )} </GestureHandlerRootView> ); } ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces
SharedValue
bindings to config. This will allow users to specify values in config asSharedValues
, e.g:Test plan
Tested on the following code: