react-native
react-native copied to clipboard
React Native as Fragments crashes when navigate to another React Native Fragment in Android Native app.
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
0.73.0
Is this a regression from 0.72?
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.
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?
Oh sorry, I meant that I upgraded to 0.73 from 0.72.7.
"react-native": "^0.73.0”, in package.json and const val ReactAndroidVersion = “0.73” in Android kotlin code.
And with those, we will still see the crash. Thanks for your help.
On Dec 8, 2023, at 9:18 PM, Nicola Corti @.***> wrote:
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?
— Reply to this email directly, view it on GitHub https://github.com/facebook/react-native/issues/41850#issuecomment-1847247993, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAWE3O7U3AK3FIMKZ3M2D3YIMOT3AVCNFSM6AAAAABAME6SYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBXGI2DOOJZGM. You are receiving this because you authored the thread.
And with those, we will still see the crash. Thanks for your help.
So you had the crash in 0.72 also?
Yes. And I upgraded in between trying to fix the issue.On Dec 9, 2023, at 12:11 AM, Nicola Corti @.***> wrote:
And with those, we will still see the crash. Thanks for your help.
So you had the crash in 0.72 also?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
Hi, I am wondering if there is anything I can do to help resolve the issues? Appreciate your help.
I'm running into this as well.
@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.
It's hard to reproduce, it's completely random.