wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

RN 0.74 New Architecture Support #7874

Open TheLonelyAstronaut opened 6 months ago

TheLonelyAstronaut commented 6 months ago

What happened?

After migration playground app to RN 74.0 with New Architecture enabled (Bridgeless mode enabled or disabled, same result), lib stopped working as expected (at least for iOS):

Tab bar and header are shown, but other content of the screen are not rendered. UIView, that located in the 'empty place' and holds RN View, occupies all available space, however, react component is not rendered (events are fired, checked in EventObserver on JS side), event constructor of class component is not called (thats why it not binds to EventObserver and events are not passed to component directly).

There is one more major problem for Android: starting from 0.74 version, interop with legacy architecture becomes stable, however, support of ShadowNodes was removed (it a problem for Android modal implementation).

Need to fix this, but it will be a good idea to reimplement core of this library to not use bridge at all, at least for Bridgeless mode, that now enabled by default with Fabric

What was the expected behaviour?

It should render content

Was it tested on latest react-native-navigation?

Help us reproduce this issue!

Minimal reproducible example

In what environment did this happen?

React Native Navigation version: 7.39.2 React Native version: 0.74.0 Has Fabric (React Native's new rendering system) enabled: yes Node version: 18

NiuGuohui commented 6 months ago

I think RNN has also encountered this issue: https://github.com/facebook/react-native/issues/44266

TheLonelyAstronaut commented 6 months ago

@NiuGuohui well, iOS behaves differently. RNNAppDelegate uses RCTSurfacePresenterBridgeAdapter, but in new arch mode it's not working as it was in RN 0.73 (bridgeAdapter.surfacePresenter is always nil). Internally RCTSurfacePresenterBridgeAdapter uses NSNotificationCenter on bridge to handle events like handleJavaScriptDidLoadNotification and other, that should control surfacePresenter lifecycle, but it's not happening anymore. If we fix this, it will be only temporary solution, cause sometime in the future RCTSurfacePresenterBridgeAdapter becomes deprecated. It's important to fully exclude bridge to be able to launch this lib in future RN versions.

(Idk whats happening on Android, digging into iOS right now)

FYI @asafkorem

TheLonelyAstronaut commented 6 months ago

Got it working on iOS Fabric with disabled bridgeless, working on bridgeless mode 🚧

TheLonelyAstronaut commented 6 months ago

PR @asafkorem

nueza99 commented 5 months ago

i am getting react-native-navigation:compileReactNative71DebugJavaWithJavac. stucked 2 days on this. This happen when i upgrade to RN 0.74 .How to solve it in android?

nicolaosm commented 3 months ago

We're also getting :react-native-navigation:compileReactNative71DebugKotlin any suggestions?

pgalwa commented 3 months ago

I am getting it too

alexjs87 commented 1 month ago

+1

nueza99 commented 1 month ago

Can try this one rnn issue