wix / react-native-navigation

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

Fabric is not working on IOS. #7865

Closed gosha212 closed 2 months ago

gosha212 commented 2 months ago

What happened?

When fabric is enabled on iOS we are getting a white screen. Looks like it never used to work. Demo repo: https://github.com/asafkorem/react-native-navigation-demo

What was the expected behaviour?

No response

Was it tested on latest react-native-navigation?

Help us reproduce this issue!

No response

In what environment did this happen?

React Native Navigation version: 0.73.2 React Native version: Has Fabric (React Native's new rendering system) enabled: (yes/no) yes Node version: Device model: iOS version:

TheLonelyAstronaut commented 2 months ago

Hey, I spent some time and investigated an issue:

After migration to RN73 (Thanks, @gosha212),RNNReactView now extends from RCTSurfaceHostingProxyRootView and uses new initWithBridge: implementation (with Fabric) with RCTFabricSurface instance. In initWithBridge: method, we call [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode], but this method located in RCTSurfaceHostingView (parent for RCTSurfaceHostingProxyRootView) and does not call [surface start] (unlike RCTSurfaceHostingProxyRootView [super initWithSurface:surface] that calls it, but it does not allow us to specify RCTSurfaceSizeMeasureMode), so all we need to do is to call [surface start] after RNNReactView init:

New Expo app ![image](https://github.com/wix/react-native-navigation/assets/50376577/addc8554-7d37-468d-bc9f-c312b5d09a19)
RNN Playground ![image](https://github.com/wix/react-native-navigation/assets/50376577/3e4d9826-2783-4261-8328-f014cdfdf673)

Created a very small PR to fix this issue: Fix

Also few days ago I created Expo plugin for this wonderful library, it supports SDK 49 and SDK 50 (RN 72 & 73): RNN Expo Plugin