React Native as Fragments crashes when navigate to another React Native Fragment in Android Native app.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
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
- run yarn to install all the js dependencies
- run yarn start to start the metro server
- run yarn android to deploy to the connected android virtual device
- click back and forth between the two tabs in the app.
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked reproducer with the listed yarn, Metro, and Android steps, then switch between the two tabs while capturing the crash. Start with the stack-trace path through ReactFragment.java, ReactDelegate.java, and ReactInstanceManager.java, especially onHostPause; done means repeated tab switching no longer crashes the Android app.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100