forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fabric] Let surface presenter manage start of surface
- Loading branch information
Showing
2 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ @implementation RCTSurfacePresenter { | |
std::shared_ptr<const ReactNativeConfig> _reactNativeConfig; | ||
better::shared_mutex _observerListMutex; | ||
NSMutableArray<id<RCTSurfacePresenterObserver>> *_observers; | ||
BOOL _isFirstJavaScriptLoaded; | ||
} | ||
|
||
- (instancetype)initWithBridge:(RCTBridge *)bridge config:(std::shared_ptr<const ReactNativeConfig>)config | ||
|
@@ -76,6 +77,8 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge config:(std::shared_ptr<const | |
} | ||
|
||
_observers = [NSMutableArray array]; | ||
|
||
_isFirstJavaScriptLoaded = YES; | ||
|
||
[[NSNotificationCenter defaultCenter] addObserver:self | ||
selector:@selector(handleBridgeWillReloadNotification:) | ||
|
@@ -394,8 +397,9 @@ - (void)handleBridgeWillReloadNotification:(NSNotification *)notification | |
- (void)handleJavaScriptDidLoadNotification:(NSNotification *)notification | ||
{ | ||
RCTBridge *bridge = notification.userInfo[@"bridge"]; | ||
if (bridge != _batchedBridge) { | ||
if (bridge != _batchedBridge || _isFirstJavaScriptLoaded) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zhongwuzw
Author
Owner
|
||
_batchedBridge = bridge; | ||
_isFirstJavaScriptLoaded = NO; | ||
|
||
[self _startAllSurfaces]; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What's the logic behind this? What we are trying to fix and how?