mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Avoid dispatch_async in RCTRootView when bridge has already started
Summary: There's no good reason for initialProperties to be mutable after the RCTRootView has been created. Passing it in through the constructor means we can skip one dispatch_async.
This commit is contained in:
@@ -82,6 +82,7 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
|
||||
@autoreleasepool {
|
||||
RCTRootView *view = [[RCTRootView alloc] initWithBundleURL:nil
|
||||
moduleName:@""
|
||||
initialProperties:nil
|
||||
launchOptions:nil];
|
||||
weakBridge = view.bridge;
|
||||
XCTAssertNotNil(weakBridge, @"RCTBridge should have been created");
|
||||
@@ -180,7 +181,7 @@ RCT_EXPORT_METHOD(test:(__unused NSString *)a
|
||||
launchOptions:nil];
|
||||
__weak UIView *rootContentView;
|
||||
@autoreleasepool {
|
||||
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@""];
|
||||
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"" initialProperties:nil];
|
||||
RUN_RUNLOOP_WHILE(!(rootContentView = [rootView valueForKey:@"contentView"]))
|
||||
XCTAssertTrue(rootContentView.userInteractionEnabled, @"RCTContentView should be valid");
|
||||
(void)rootView;
|
||||
|
||||
Reference in New Issue
Block a user