| #
d4cd4dfc |
| 19-Dec-2022 |
Kudo Chien <[email protected]> |
[modules] Fix incompatible issue for react-native 0.71 (#20470)
# Why
sdk 48 may come next year and react-native 0.71 may be released this year. it's good to have react-native 0.71 support for ou
[modules] Fix incompatible issue for react-native 0.71 (#20470)
# Why
sdk 48 may come next year and react-native 0.71 may be released this year. it's good to have react-native 0.71 support for our modules. if users want to upgrade 0.71, they could change their project to be a bare project for the early preview.
# How
- [core][av][gl] because 0.71 doesn't serve android aar along with npm package, the aar extraction from `node_modules/react-native/android/**/*.aar` will break on 0.71. 0.71 also ships modules with prefab support. it's good to rewrite the gradle/cmake files to link with prefab modules. that would reduce much complexity. however, to be backward compatible with 0.70, i moved most logic to `ExpoModulesCorePlugin.applyLegacyReactNativeLibsExtractionPlugin` and `legacy/CMakeLists.txt`. so that we could be backward compatible and easily remove the isolated code after we drop sdk 47 support.
- [dev-launcher] add 0.71 sources because new parameter to `DevSupportManagerBase`
- [core][dev-menu] fix ios build errors for jsc because 0.71 moved the header to `<React-jsc/JSCRuntime.h>`
- [core][autolinking] integrate the `RCTAppDelegate` with our `EXAppDelegateWrapper`. that would simply the install-expo-modules migration where we only need the change `RCTAppDelegate -> EXAppDelegateWrapper` in AppDelegate.h. however, integrate RCTAppDelegate comes with some issues from expo-modules-core. [this commit](https://github.com/expo/expo/pull/20470/commits/2959477c5782f5d3ef770fbe72b04c1770bc566b) changes many code and i'll try to explain here:
- RCTAppDelegate is in `React-RCTAppDelegate` pod, which does not define module. we define module for it in our patch system in autolinking.
- defines `RCT_NEW_ARCH_ENABLED` as RCTAppDelegate
- in new architecture mode, RCTAppDelegate comes with [more cxx dependencies](https://github.com/facebook/react-native/blob/03b17d9af7e4e3ad3f9ec078b76d0ffa33a3290e/Libraries/AppDelegate/RCTAppDelegate.h#L12-L18) for fabric. that's why we should add more header search paths and also move to EXAppDelegateWrapper.mm.
# Test Plan
- [x] ci passed
- [x] bare-expo build and launch
- [x] bare-expo nightlies build and launch
- [x] fabric-tester build and launch
- [x] fabric-tester nighties build and launch (should apply [the patch to fabric-tester](https://gist.github.com/Kudo/417a5159cb01a400ecee22ad4985d287))
- [x] rn 0.71-rc4 project build and launch (could apply [the patches](https://gist.github.com/Kudo/7448c733f12e700c7fbed76251fa3553) for testing)
- [x] rn 0.71-rc4 project (new architecture) build and launch ([this pr](https://github.com/facebook/react-native/pull/35661) for react-native is required)
- [x] rn 0.71-rc4 project (use_frameworks!) build and launch
show more ...
|