-
-
Notifications
You must be signed in to change notification settings - Fork 867
Add react-native-reanimated v4 support #2374
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
base: master
Are you sure you want to change the base?
Conversation
I'm testing it by including on a example app using: "@gorhom/bottom-sheet": "git+https://github.com/lucaswitch/react-native-bottom-sheet.git", |
Its not done yet. I ll work on it tomorrow |
Did anyone faced an issue that BottomSheetModals are being dismissed immediately (they are rendered for like 50ms and closing)? :/ |
src/hooks/useWorkletCallback.ts
Outdated
: function useWorkletCallback<T extends (...args: any[]) => any>(callback: T, deps: readonly unknown[]): T { | ||
return useCallback((...args: Parameters<T>): ReturnType<T> => { | ||
'worklet'; | ||
return callback?.(...args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got the following error: Error: [Worklets] Tried to synchronously call a non-worklet function
evaluatePosition on the UI thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, i'm seeing that error still looks like the current approach is not enough for inner functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is happening after this pull request somehow there some behavior changes between reanimated v3 and reanimated v4. I'm looking forward to see whats happening. |
But must be something with the my application and yours cause the example apple is running smooth |
https://github.com/user-attachments/assets/1b55807e-15e7-4825-a715-33041ee842a4 |
I'll test on v4 |
This is happening on v4 |
Screen.Recording.2025-07-25.at.17.36.08.movThis is the current behavior with reanimated v4. |
Yep got same issue with reanimated v4, the BottomSheetModal just closes if the content is smaller than 50% of the height of the device. |
@lucaswitch thanks for submitting this PR, im working now in merging it with #2223 & #2356 |
Yeah I get this with reanimated v4 + bottom sheet 5.1.8 |
First of all, thank you for this library. Basically a "must install" on almost every react-native project.
This pull request is responsible for adding support to react-native-reanimated v4.
Motivation
React Native Reanimated v4 introduces some breaking changes, but we want to maintain compatibility by continuing to support it within the existing v5 branch.
To achieve this, we added a custom useWorkletCallback hook that performs a runtime check: if the original useWorkletCallback is available, it uses it; otherwise, it falls back to the new approach described in the official documentation.
I also removed addWhitelistedNativeProps and addWhitelistedUIProps since they are no longer used in v4.
This update still requires testing before production release, so it can be considered a release candidate for now.