mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix(iOS) [0.74]: properly warn about createRootViewWithBridge (#43146)
Summary:
This PR fixes an issue that `_logWarnIfCreateRootViewWithBridgeIsOverridden` was called in wrong place.
Assuming user overrides this method and call to `[super]`:
```objc
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName initProps:(NSDictionary *)initProps {
UIView *view = [super createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps];
view.backgroundColor = [UIColor redColor];
return view;
}
```
This method still wasn't called in bridgeless (and not showing the error).
Checking if user overrides this method in `appDidFinishWithLaunching` works every time

## Changelog:
[IOS] [FIXED] - Properly warn about `createRootViewWithBridge` being deprecated
Pull Request resolved: https://github.com/facebook/react-native/pull/43146
Test Plan: Check if warning is shown when message is overridden
Reviewed By: huntie
Differential Revision: D54303506
Pulled By: cipolleschi
fbshipit-source-id: cf30555c791493f28b3015a189cf93b60cace8f8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c3b0a8f162
commit
a1197695fc
@@ -118,6 +118,7 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
||||
}
|
||||
rootView = [self createRootViewWithBridge:self.bridge moduleName:self.moduleName initProps:initProps];
|
||||
}
|
||||
[self _logWarnIfCreateRootViewWithBridgeIsOverridden];
|
||||
[self customizeRootView:(RCTRootView *)rootView];
|
||||
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
||||
UIViewController *rootViewController = [self createRootViewController];
|
||||
@@ -160,7 +161,6 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
||||
moduleName:(NSString *)moduleName
|
||||
initProps:(NSDictionary *)initProps
|
||||
{
|
||||
[self _logWarnIfCreateRootViewWithBridgeIsOverridden];
|
||||
BOOL enableFabric = self.fabricEnabled;
|
||||
UIView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user