Skip to content

Commit

Permalink
Update RNTester AppDelegate for changes made to SurfacePresenter API (#…
Browse files Browse the repository at this point in the history
…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: #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
  • Loading branch information
empyrical authored and facebook-github-bot committed Apr 14, 2020
1 parent 9c54bf4 commit e0da72a
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions RNTester/RNTester/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@

#ifdef RN_FABRIC_ENABLED
#import <React/RCTSurfacePresenter.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <React/RCTFabricSurfaceHostingProxyRootView.h>

#import <react/config/ReactNativeConfig.h>
#endif


Expand All @@ -53,7 +56,9 @@
@interface AppDelegate() <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate>{

#ifdef RN_FABRIC_ENABLED
RCTSurfacePresenter *_surfacePresenter;
RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
facebook::react::ContextContainer::Shared _contextContainer;
#endif

RCTTurboModuleManager *_turboModuleManager;
Expand All @@ -77,14 +82,15 @@ - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWith
}

#ifdef RN_FABRIC_ENABLED
_surfacePresenter = [[RCTSurfacePresenter alloc] initWithBridge:_bridge
config:nil
imageLoader:RCTTurboModuleEnabled() ?
[_bridge moduleForName:@"RCTImageLoader"
lazilyLoadIfNecessary:YES] : nil
runtimeExecutor:nullptr];

_bridge.surfacePresenter = _surfacePresenter;
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
_reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();

_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];
#else
Expand Down

0 comments on commit e0da72a

Please sign in to comment.