Skip to content

fix(iOS) [0.74]: properly warn about createRootViewWithBridge - #43146

Closed
okwasniewski wants to merge 1 commit into
react:mainfrom
okwasniewski:fix/properly-warn-deprecated-method
Closed

fix(iOS) [0.74]: properly warn about createRootViewWithBridge#43146
okwasniewski wants to merge 1 commit into
react:mainfrom
okwasniewski:fix/properly-warn-deprecated-method

Conversation

@okwasniewski

Copy link
Copy Markdown
Contributor

Summary:

This PR fixes an issue that _logWarnIfCreateRootViewWithBridgeIsOverridden was called in wrong place.

Assuming user overrides this method and call to [super]:

- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName initProps:(NSDictionary *)initProps {
UIView *view = [supercreateRootViewWithBridge: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

simulator_screenshot_0E22557C-CE37-4617-A25A-F39A6ED4D3D0

Changelog:

[IOS] [FIXED] - Properly warn about createRootViewWithBridge being deprecated

Test Plan:

Check if warning is shown when message is overridden

@facebook-github-botfacebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner labels Feb 22, 2024
@okwasniewski

Copy link
Copy Markdown
ContributorAuthor

cc: @cipolleschi

@analysis-bot

analysis-bot commented Feb 22, 2024

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a17,935,061-65,622
androidhermesarmeabi-v7an/a--
androidhermesx86n/a--
androidhermesx86_64n/a--
androidjscarm64-v8a21,293,286-65,778
androidjscarmeabi-v7an/a--
androidjscx86n/a--
androidjscx86_64n/a--

Base commit: 073ca1a
Branch: main

@cipolleschi

Copy link
Copy Markdown
Contributor

can you please add a cherry pick request in the proper discussion?

@okwasniewski

Copy link
Copy Markdown
ContributorAuthor

Added: reactwg/react-native-releases#104 (comment)

So I should re-target this to main?

@cipolleschi

Copy link
Copy Markdown
Contributor

probably yes.

@okwasniewski
okwasniewskiforce-pushed the fix/properly-warn-deprecated-method branch from 3b3925a to a18663cCompareFebruary 23, 2024 09:03
@okwasniewski
okwasniewski changed the base branch from 0.74-stable to mainFebruary 23, 2024 09:03
@okwasniewski
okwasniewskiforce-pushed the fix/properly-warn-deprecated-method branch from a18663c to 5d9b8b2CompareFebruary 23, 2024 09:03
@okwasniewski

Copy link
Copy Markdown
ContributorAuthor

@cipolleschi I've changed the target

@facebook-github-botfacebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 23, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-botfacebook-github-bot added the Merged This PR has been merged. label Feb 28, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@cipolleschi merged this pull request in a119769.

huntie pushed a commit that referenced this pull request Mar 4, 2024
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
![simulator_screenshot_0E22557C-CE37-4617-A25A-F39A6ED4D3D0](https://github.com/facebook/react-native/assets/52801365/d7865f37-32f0-40ad-a252-74ab7c5b7757)
## Changelog:
[IOS] [FIXED] - Properly warn about `createRootViewWithBridge` being deprecated
Pull Request resolved: #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
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.MergedThis PR has been merged.p: CallstackPartner: CallstackPartnerPick RequestShared with MetaApplied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@okwasniewski@analysis-bot@cipolleschi@facebook-github-bot