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 as Fragments crashes when navigate to another React Native Fragment in Android Native app. #41850

Open
wpoosanguansit opened this issue Dec 8, 2023 · 10 comments
Labels

Comments

@wpoosanguansit
Copy link

wpoosanguansit commented Dec 8, 2023

Description

Hi,

I do have two tabs that host React Native as fragments in the android kotlin app. I would predictably see the app crashes if I switch between tabs that host React Native fragments. If I just go to one of the tab and not between them, the app functions longer. But it would crash within a few clicks on the tabs after I enter into two tabs that host RN fragments.

Steps to reproduce

  1. run yarn to install all the js dependencies
  2. run yarn start to start the metro server
  3. run yarn android to deploy to the connected android virtual device
  4. click back and forth between the two tabs in the app.
  5. then you would see the app crashes after not more than 10 clicks.

React Native Version

0.73.0

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.1.2
  CPU: (10) arm64 Apple M1 Max
  Memory: 1.01 GB / 64.00 GB
  Shell:
    version: 3.6.1
    path: /opt/homebrew/bin/fish
Binaries:
  Node:
    version: 21.2.0
    path: /opt/homebrew/opt/node@21/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.4
    path: /opt/homebrew/opt/node@21/bin/npm
  Watchman:
    version: 2023.11.27.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK:
    API Levels:
      - "21"
      - "25"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 21.1.2
      - 24.0.0
      - 25.0.0
      - 28.0.3
      - 29.0.2
      - 30.0.0
      - 30.0.1
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-21 | Google APIs ARM 64 v8a
      - android-25 | Google APIs Intel x86 Atom
      - android-27 | Google APIs ARM 64 v8a
      - android-28 | Google APIs Intel x86_64 Atom
      - android-29 | Google Play ARM 64 v8a
      - android-30 | ARM 64 v8a
      - android-31 | Google TV ARM 64 v8a
      - android-32 | Google Play ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-TiramisuPrivacySandbox | Google APIs ARM 64 v8a
      - android-UpsideDownCakePrivacySandbox | Google Play ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 18.0.2.1
    path: /Users/watt/.jenv/shims/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.0
    wanted: ^0.73.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

Process: com.playground.internal, PID: 20145
                                                                                                    java.lang.AssertionError
                                                                                                    	at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:82)
                                                                                                    	at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:581)
                                                                                                    	at com.facebook.react.ReactDelegate.onHostPause(ReactDelegate.java:107)
                                                                                                    	at com.facebook.react.ReactFragment.onPause(ReactFragment.java:110)
                                                                                                    	at androidx.fragment.app.Fragment.performPause(Fragment.java:3330)
                                                                                                    	at androidx.fragment.app.FragmentStateManager.pause(FragmentStateManager.java:684)
                                                                                                    	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:310)
                                                                                                    	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2088)
                                                                                                    	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1970)
                                                                                                    	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1925)
                                                                                                    	at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:643)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Reproducer

https://github.com/wpoosanguansit/internal

Screenshots and Videos

Screen Recording 2023-12-08 at 12 34 00 PM

@github-actions github-actions bot added the Platform: Android Android applications. label Dec 8, 2023
@cortinico
Copy link
Contributor

0.73.0

Is this a regression from 0.72?

@wpoosanguansit
Copy link
Author

I upgraded from 0.72.7. And added the second Fragment to see the issue. Just like to add that if I do have just one RN fragment and do not have a second one in the mix, things seem to work without the particular crash. Thanks for your help.

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Dec 8, 2023
@cortinico
Copy link
Contributor

I upgraded from 0.72.7. And added the second Fragment to see the issue

What I asked is if we take your reproducer, and move it to 0.73.0, will the crash still happen?

@wpoosanguansit
Copy link
Author

wpoosanguansit commented Dec 8, 2023 via email

@cortinico
Copy link
Contributor

And with those, we will still see the crash. Thanks for your help.

So you had the crash in 0.72 also?

@wpoosanguansit
Copy link
Author

wpoosanguansit commented Dec 8, 2023 via email

@cortinico cortinico removed the Needs: Attention Issues where the author has responded to feedback. label Dec 8, 2023
@wpoosanguansit
Copy link
Author

Hi, I am wondering if there is anything I can do to help resolve the issues? Appreciate your help.

@OneOfOne
Copy link

I'm running into this as well.

@wpoosanguansit
Copy link
Author

@OneOfOne Would it be possible for you to upload your isolated code as well? That might help the team to tackle this issue. Hopefully this is still in their queue. Thanks.

@OneOfOne
Copy link

OneOfOne commented Apr 8, 2024

It's hard to reproduce, it's completely random.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants