Update RNTester AppDelegate for changes made to SurfacePresenter API (#28580)

Summary:
This pull request updates RNTester's AppDelegate's Fabric mode to reflect changes made to the SurfacePresenter APIs. It now makes use of `RCTSurfacePresenterBridgeAdapter` to create its `SurfacePresenter`.

## Changelog

[Internal] [Fixed] - Fixed outdated API usage in RNTester's AppDelegate
Pull Request resolved: https://github.com/facebook/react-native/pull/28580

Test Plan: `RNTester/RNTester/AppDelegate.mm` now compiles without error when `RN_FABRIC_ENABLED` is enabled.

Reviewed By: hramos

Differential Revision: D20966067

Pulled By: mdvacca

fbshipit-source-id: 8d0168d468240cff61554f2f2df799aaf5d876c1
This commit is contained in:
empyrical 2020-04-14 12:09:16 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 9c54bf4199
Коммит e0da72ab68
1 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -30,7 +30,10 @@
#ifdef RN_FABRIC_ENABLED #ifdef RN_FABRIC_ENABLED
#import <React/RCTSurfacePresenter.h> #import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h> #import <React/RCTFabricSurfaceHostingProxyRootView.h>
#import <react/config/ReactNativeConfig.h>
#endif #endif
@ -53,7 +56,9 @@
@interface AppDelegate() <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate>{ @interface AppDelegate() <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate>{
#ifdef RN_FABRIC_ENABLED #ifdef RN_FABRIC_ENABLED
RCTSurfacePresenter *_surfacePresenter; RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
facebook::react::ContextContainer::Shared _contextContainer;
#endif #endif
RCTTurboModuleManager *_turboModuleManager; RCTTurboModuleManager *_turboModuleManager;
@ -77,14 +82,15 @@
} }
#ifdef RN_FABRIC_ENABLED #ifdef RN_FABRIC_ENABLED
_surfacePresenter = [[RCTSurfacePresenter alloc] initWithBridge:_bridge _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
config:nil _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
imageLoader:RCTTurboModuleEnabled() ?
[_bridge moduleForName:@"RCTImageLoader"
lazilyLoadIfNecessary:YES] : nil
runtimeExecutor:nullptr];
_bridge.surfacePresenter = _surfacePresenter; _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
_bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:_bridge
contextContainer:_contextContainer];
_bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
UIView *rootView = [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps]; UIView *rootView = [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps];
#else #else