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

React Native App crashes without error message when GestureDetector appears #2840

Closed
demenik opened this issue Mar 29, 2024 · 6 comments
Closed
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided

Comments

@demenik
Copy link

demenik commented Mar 29, 2024

Description

I am coding a React Native App that uses react-native-gesture-handler.

My initial setup where I first discovered the crash was a @react-navigation/native-stack NativeStack with two screens. When I show the screen with a GestureHandlerRootView at its root and a GestureDetector with a simple Gesture.Tap() gesture, the app crashes without any logs.

Steps to reproduce

I tried to simplify the app to see what causes the crash, so I changed my app to just the following code:

export default (): React.JSX.Element => {
  const test = Gesture.Tap().onBegin(() => console.log("Begin"));

  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <GestureDetector gesture={test}>
        <View style={{ flex: 1, backgroundColor: "green" }} />
      </GestureDetector>
    </GestureHandlerRootView>
  );
};

Now the app crashes on launch, so I think the crash is caused by react-native-gesture-handler.

I'm using the new react-native architecture, installed all dependencies with CocoaPods, and included import "react-native-gesture-handler"; at the top of my index.js file.

Snack or a link to a repository

https://github.com/demenik/Muse

Gesture Handler version

2.16.0

React Native version

0.73.6

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

None

Device

Real device

Device model

iPhone 13 Pro (iOS 17.4)

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided labels Mar 29, 2024
@RalissonMattias
Copy link

RalissonMattias commented Mar 29, 2024

I think we have the same or similar problem here #2839

@j-piasecki
Copy link
Member

I believe the changes necessary to support RN 0.74 on the new arch cause it to crash on 0.73. Would it be possible for you to check if it still crashes for you on 0.74?

@demenik
Copy link
Author

demenik commented Mar 30, 2024

Updating to [email protected] solved the issue. Thank you!

@demenik demenik closed this as completed Mar 30, 2024
@Ever-It-Lazy
Copy link

I sought out this bug, because I've been running into a similar problem all this past week.

  • The stable 0.73 loads, but crashes when I gesture.
  • I tried 0.72, and it does the same.
  • 0.74 & 0.75: the app crashes on launch.

My specs are a bit different:

  • Workflow: contains Expo
  • Device: iPhone X (iOS 16.7.7)

Is Expo complicating React-Native's response, you think?

@demenik
Copy link
Author

demenik commented Apr 2, 2024

@Ever-It-Lazy I think your issue is a different one, as my 0.73 app already crashed on when a GestureDetector appeared and yours crashes when using one. Have you included the import 'react-native-gesture-handler'; at the top of your index.js file?

@Ever-It-Lazy
Copy link

I've replaced my App.js with your "green screen" example code in my environment.

  • 0.73 and below loads, and the gesture works. (So apparently, our environments are different enough that I am not even replicating your problem?)
  • 0.74 and above can't even launch. It's firing errors in the react-native code library.

You appear to be correct: I must be dealing with something different. It seems similar, because my actual app began much like yours: a NativeStack with two screens. I guess I need to spawn a separate bug report for investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

No branches or pull requests

4 participants