| #
4ef7fe1b |
| 20-Dec-2022 |
Kudo Chien <[email protected]> |
[core] Fix react-native 0.71 integration errors on ios (#20539)
# Why
fix further regressions from #20470
# How
- bare-expo is still running with legacy AppDelegate where it creates
bridge
[core] Fix react-native 0.71 integration errors on ios (#20539)
# Why
fix further regressions from #20470
# How
- bare-expo is still running with legacy AppDelegate where it creates
bridge, rootView in AppDelegate.mm. even running with 0.71, the
EXAppDelegateWrapper should handle this case and not create the bridge
from RCTAppDelegate.
- workaround a build error when running with new arch mode
# Test Plan
ci passed
show more ...
|
| #
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 ...
|
| #
0f5f192f |
| 01-Dec-2021 |
Kudo Chien <[email protected]> |
[core] Introduce iOS ReactDelegate for React related instances creation (#15138)
# Why
original modularized AppDelegateWrapper isn't ideal for expo-updates. we had some bad side effect, e.g. doub
[core] Introduce iOS ReactDelegate for React related instances creation (#15138)
# Why
original modularized AppDelegateWrapper isn't ideal for expo-updates. we had some bad side effect, e.g. double bridge creation on startup.
close ENG-2299
# How
## For module authors
introduce `EXReactDelegate` dedicated for react related instances creation. so far we covered:
- RCTBridge
- RCTRootView
- RootViewController (for expo-screen-orientation)
if a module wants to handle these creation, there's 2 steps:
1. add `reactDelegateHandlers` in `expo-module.config.json`, e.g.
```
"ios": {
"reactDelegateHandlers": ["ScreenOrientationReactDelegateHandler"]
}
```
2. create `EXReactDelegateHandler` derived swift class, e.g.
```swift
// ScreenOrientationReactDelegateHandler.swift
public class ScreenOrientationReactDelegateHandler: ExpoReactDelegateHandler {
public override func createRootViewController(reactDelegate: ExpoReactDelegate) -> UIViewController? {
return EXScreenOrientationViewController()
}
}
```
since the order of whom to create the instance did matter, we also introduce `ModulePriorities.swift` similar to what we did on android.
## For app developers
the change to template is minimal, so codemod by `npx install-expo-modules` is also feasible.
```diff
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
- RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
+ RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
+ RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [UIViewController new];
+ UIViewController *rootViewController = [self.reactDelegate createRootViewController];
```
show more ...
|