Skip to content
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

Android App crash on scrollTo With PanGesture #6418

Closed
DonBrowny opened this issue Aug 15, 2024 · 7 comments
Closed

Android App crash on scrollTo With PanGesture #6418

DonBrowny opened this issue Aug 15, 2024 · 7 comments
Assignees
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@DonBrowny
Copy link

Description

I am trying to trying to create a Drag-Sort component with react-native-reanimated and react-native-gesture-handler.
I came across this old snack - https://snack.expo.dev/@stewartarmbrecht/apple-music-drag-and-sort-working?platform=android and try to use it with the latest version of react-native and the app crashed when the scrollTo is triggered.

Screen.Recording.2024-08-15.at.11.21.16.PM.mov

Steps to reproduce

yarn start --reset-cache
and open the app in android-emulator

Snack or a link to a repository

https://github.com/DonBrowny/AnimationTest

Reanimated version

3.15.0

React Native version

0.75.1

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

Fabric (New Architecture)

Build type

None

Device

Android emulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided Platform: Android This issue is specific to Android labels Aug 15, 2024
@MatiPl01
Copy link
Member

I encountered the same issue. Thanks for reporting. I will forward the issue to the person who has been working on this recently.

@DonBrowny
Copy link
Author

@bartlomiejbloniarz To narrow down the suspects for you, this issue occurs even on react-native-74.1 so this not specific to React Native update and i have also tried replacing the deprecated API with the alternatives/new way of handling gesture and faced the same issue. Let me know if you need any help in debugging this.

@bartlomiejbloniarz
Copy link
Contributor

Hi @DonBrowny. This problems occurs, because when the user is moving an item, it triggers an update. This update synchronously triggers the logic responsible for scrolling the list (so it triggers another update). This means that there is a recursive call to the ShadowTree::commit function in RN. Currently such recursive calls lead to a deadlock (on Android). The issue seems to have been noticed by the RN team and had been addressed in this PR, but the fix is currently behind a feature flag. I tested it, and it seems to resolve our issue. I'm not sure when this behavior will be made default.

@DonBrowny
Copy link
Author

@bartlomiejbloniarz Thanks for digging into this. Can you please let me know how to enable the FF and test this?

@bartlomiejbloniarz
Copy link
Contributor

I just changed the invocation of the FF getter to a true value. For this I also had to build RN from source.

@DonBrowny
Copy link
Author

Got it, Thanks. I will close this issue since it's a issue in the react-native framework and not on this library.

@dppo
Copy link

dppo commented Oct 29, 2024

@DonBrowny I encountered the same problem, is there any solution?

rubennorte added a commit to rubennorte/react-native that referenced this issue Nov 18, 2024
…roid`

Summary:
Changelog: [Android][Fixed] Fixes some deadlocks when doing commits and state updates synchronously from the UI thread (e.g.: from reanimated).

This removes the gating for the fix to allow recursive commits with synchronous mount on Android.

See facebook#44725 (comment) and software-mansion/react-native-reanimated#6418 (comment).

Differential Revision: D66095539
facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Nov 18, 2024
…roid` (#47665)

Summary:
Pull Request resolved: #47665

Changelog: [Android][Fixed] Fixes some deadlocks when doing commits and state updates synchronously from the UI thread (e.g.: from reanimated).

This removes the gating for the fix to allow recursive commits with synchronous mount on Android.

See #44725 (comment) and software-mansion/react-native-reanimated#6418 (comment).

Reviewed By: sammy-SC

Differential Revision: D66095539

fbshipit-source-id: 63b8c4d9161a40159601b8e3b45f7e5c7cdd83e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided
Projects
None yet
Development

No branches or pull requests

4 participants