react-native-bottom-sheet icon indicating copy to clipboard operation
react-native-bottom-sheet copied to clipboard

Add react-native-reanimated v4 support

Open lucaswitch opened this issue 5 months ago • 24 comments

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.

lucaswitch avatar Jul 24 '25 19:07 lucaswitch

I'm testing it by including on a example app using: "@gorhom/bottom-sheet": "git+https://github.com/lucaswitch/react-native-bottom-sheet.git",

lucaswitch avatar Jul 24 '25 21:07 lucaswitch

Its not done yet. I ll work on it tomorrow

lucaswitch avatar Jul 25 '25 03:07 lucaswitch

Did anyone faced an issue that BottomSheetModals are being dismissed immediately (they are rendered for like 50ms and closing)? :/

Splanis avatar Jul 25 '25 12:07 Splanis

Did anyone faced an issue that BottomSheetModals are being dismissed immediately (they are rendered for like 50ms and closing)? :/

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.

lucaswitch avatar Jul 25 '25 13:07 lucaswitch

Did anyone faced an issue that BottomSheetModals are being dismissed immediately (they are rendered for like 50ms and closing)? :/

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

lucaswitch avatar Jul 25 '25 13:07 lucaswitch

https://github.com/user-attachments/assets/1b55807e-15e7-4825-a715-33041ee842a4 Test with v3 "react-native-reanimated": "~3.17.4"

lucaswitch avatar Jul 25 '25 13:07 lucaswitch

https://github.com/user-attachments/assets/1b55807e-15e7-4825-a715-33041ee842a4 Test with v3 "react-native-reanimated": "~3.17.4"

I'll test on v4

lucaswitch avatar Jul 25 '25 14:07 lucaswitch

Did anyone faced an issue that BottomSheetModals are being dismissed immediately (they are rendered for like 50ms and closing)? :/

This is happening on v4

lucaswitch avatar Jul 25 '25 17:07 lucaswitch

image

Getting this using your master branch and reanimated 4, sometimes it opens or not, sometimes i am getting this error

"@gorhom/bottom-sheet": "github:lucaswitch/react-native-bottom-sheet", "react-native-reanimated": "~4.0.0",

lyonscrawl avatar Jul 25 '25 20:07 lyonscrawl

image Getting this using your master branch and reanimated 4, sometimes it opens or not, sometimes i am getting this error

"@gorhom/bottom-sheet": "github:lucaswitch/react-native-bottom-sheet", "react-native-reanimated": "~4.0.0",

Yep it's not ready yet. I'm trying to fix it. Also the SectionList example is not working yet.

lucaswitch avatar Jul 25 '25 20:07 lucaswitch

https://github.com/user-attachments/assets/6bd0996b-60e4-44b4-8e7c-2c9605021c70

This is the current behavior with reanimated v4.

lucaswitch avatar Jul 25 '25 20:07 lucaswitch

Yep got same issue with reanimated v4, the BottomSheetModal just closes if the content is smaller than 50% of the height of the device.

matiaswastaken avatar Jul 30 '25 16:07 matiaswastaken

@lucaswitch thanks for submitting this PR, im working now in merging it with https://github.com/gorhom/react-native-bottom-sheet/pull/2223 & https://github.com/gorhom/react-native-bottom-sheet/pull/2356

gorhom avatar Aug 03 '25 18:08 gorhom

Yep got same issue with reanimated v4, the BottomSheetModal just closes if the content is smaller than 50% of the height of the device.

Yeah I get this with reanimated v4 + bottom sheet 5.1.8

ericpoulinnz avatar Aug 05 '25 04:08 ericpoulinnz

@lucaswitch @gorhom Thanks for doing this. This is a bit of a blocker for what I'm working on, anything I can help with to get this in?

tigranpetrossian avatar Aug 11 '25 07:08 tigranpetrossian

Yes! every help wanted, what we are facing now is a behavior change between reanimated v3 and v4 somehow on modals it cannot detect the children elements size correctly. I'm in a middle of a release in the company i'm working on so i'm not working on it this week.

lucaswitch avatar Aug 11 '25 12:08 lucaswitch

Thanks @lucaswitch It looks like updating RNR to v4.0.2 fixes the modal issue, but I had no luck so far in understanding the cause for SectionList/VirtualizedList crashing. Will spend a little more time later today looking into it.

tigranpetrossian avatar Aug 12 '25 11:08 tigranpetrossian

I tried the template with EXPO SDK 54, and it's not working

I get a warning Couldn't find the scrollable node handle id!

And when I try to scroll, the app crashes

My basic code

<BottomSheetModal>
    <BottomSheetScrollView>
        {My code...}
    </BottomSheetScrollView>
</BottomSheetModal>

package.json

    "@gorhom/bottom-sheet": "^5.2.6",
    "react-native-reanimated": "~4.1.0",
    "react-native-worklets": "^0.5.1"

Chirag7096 avatar Sep 11 '25 00:09 Chirag7096

@lucaswitch @tigranpetrossian I don't know why exactly but after investigating using AI the issue on SectionList/VirtualizedList crashing seems to be related to useAnimatedRef of useScrollHandler: changing it to useRef make it works but I have no idea what this change would break. image

Not sure about the AI but this is what it is saying: image

I hope this helps ?

christophehurpeau avatar Sep 14 '25 14:09 christophehurpeau

Any updates? 😢

Nasseratic avatar Oct 16 '25 14:10 Nasseratic

Can we get this updated please? Getting spammed by Couldn't find the scrollable node handle id! warnings

jvgeee avatar Oct 28 '25 21:10 jvgeee

Any updates?

veliseev93 avatar Oct 30 '25 06:10 veliseev93

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Nov 29 '25 09:11 github-actions[bot]

Any updates 😢

Nasseratic avatar Nov 29 '25 12:11 Nasseratic

Any updates? I'm still facing this issue after upgrading to reanimated v4 and expo 54

khacbac avatar Dec 17 '25 06:12 khacbac

Any updates?

vladanmikic avatar Dec 19 '25 15:12 vladanmikic