Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Fixes root view's background color in bridgeless mode #42739

Conversation

zhongwuzw
Copy link
Contributor

Summary:

Fixes root view's background color in bridgeless mode, the top area has white background color when in dark mode.

Before:
Simulator Screenshot - iPhone 15 - 2024-01-30 at 23 28 48

After:
Simulator Screenshot - iPhone 15 - 2024-01-30 at 23 25 39

Changelog:

[IOS] [FIXED] - [iOS] Fixes the root view's background color in bridgeless mode

Test Plan:

Run RNTester and see the top area's background color.

@facebook-github-bot facebook-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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jan 30, 2024
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,151,003 +5
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 20,530,362 -11
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: b133bf6
Branch: main

@javache
Copy link
Member

javache commented Jan 30, 2024

This doesn't seem like the right location for the fix. I'd imagine that the rootview actually covers the entire screen, and that the RNTester root should set the background color on the outmost container view, instead of something that's inside the SafeAreaView.

Copy link
Member

@javache javache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix should be on the JS side.

@zhongwuzw
Copy link
Contributor Author

@javache Emm, it's the default color for the root view, actually we do the same thing in non-bridgeless mode, please see:

- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
                          moduleName:(NSString *)moduleName
                           initProps:(NSDictionary *)initProps
{
  [self _logWarnIfCreateRootViewWithBridgeIsOverridden];
  BOOL enableFabric = self.fabricEnabled;
  UIView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric);

  rootView.backgroundColor = [UIColor systemBackgroundColor];

  return rootView;
}

rootView.backgroundColor = [UIColor systemBackgroundColor];

Copy link
Member

@javache javache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for pointing that out. Still not a big fan for this, but let's do it for consistency.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 31, 2024
@facebook-github-bot
Copy link
Contributor

@javache merged this pull request in 0bbc311.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied 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