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 Bridgeless support #7875

Open TheLonelyAstronaut opened 6 months ago

TheLonelyAstronaut commented 6 months ago

Description

This PR adds support of new stable Bridgeless mode and partial migration from deprecated components. Still need some additional work to make iOS work, but all major issues was resolved with two first commits. To get this work properly, we need to wait this changes in next RN release, that's why RNN bridgeless will only work with RN 0.74.2 and higher (This changes are from Expo team cause they also need such functionality).

What was done

Common:

iOS:

TODO

Common:

iOS:

Android:

TheLonelyAstronaut commented 6 months ago

🚀

image

Arkkeeper commented 6 months ago

Thanks for a great PR! But could you please check one more thing: what happens if Navigation.setRoot is called once again? (for example, when any button on the root screen calls this method)

TheLonelyAstronaut commented 6 months ago

@Arkkeeper sure, I'll check this, but it could be a bit buggy (PR is still a draft/PoC, im planning to finish with iOS next week and start android), hope to resolve all the issues

TheLonelyAstronaut commented 6 months ago

There is an interesting moment regarding new architecture: RCTEventEmitter fires 'didApper' event before component actually was created (event JS component class constructor was not been called yet).

Native call is triggered by viewDidApper lifecycle iOS event when native navigator is ready, but react view is still not, that's why after loading of react view we are getting correct view, but no event about appear status.

I think it's because of synchronous nature of new architecture, cause with old architecture we sending events from native before first render, but they emitted in JS only after render. Workaround - waitForRender: true by default with Fabric/New Architecture, but it could be reverted by setting navigation options.

TheLonelyAstronaut commented 6 months ago

iOS example app now works fine for both old and new archs (with and without bridge) 🎉

Working on ToDo list right now

TheLonelyAstronaut commented 6 months ago

After porting SharedElementTransition example to Reanimated 3 (to support bridgeless), i found that new Reaniamted does not support multiple surfaces yet (one native screen - one surface)

image

To fix this locally, we actually need to change assertion to if branch and return nullptr as result of commit lambda

image

enahum commented 6 months ago

Looking forward to this one 🎉🎉

enahum commented 5 months ago

@TheLonelyAstronaut can you share an update on your progress?

lukutism commented 5 months ago

Bump, looking forward for this.

lukutism commented 4 months ago

@TheLonelyAstronaut Hi, any progress ? If you are busy, can you describe what is left to be done, I could take over. Thanks :)

TheLonelyAstronaut commented 4 months ago

@lukutism Hi, no progress yet, i have very complex task on my job right now. You could start Android implementation, I did only iOS things

lichstam commented 2 weeks ago

any updates here?