-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Adapt status bar color to modal backdrop #13215
Adapt status bar color to modal backdrop #13215
Conversation
@tgolen @eVoloshchak One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, but I think the naming of things could use some work. I hope these tips are helpful!
@eVoloshchak should remain a reviewer on this PR since they were the ContributorPlus person assigned to the issue. |
Will test this tomorrow, sorry for the delay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those names are looking much better, thank you!
Also, rename method for clarity and use `undefined` over `null`.
@tgolen is there anything else you would like me to change in this PR? |
Code looks good. But there's an issue with Android, the status bar flickers when changing color Screen_Recording_20221203-223038_Chrome.mp4The behavior is the same in production build, I checked a couple of phones (android 12/13), all behave the same, probably a bug in Chrome app itself @tgolen, I'm not sure we can do anything about this, but it looks wrong in my opinion. What do you think? |
I can confirm this for Chrome on Android, although I did not notice this myself initially. Here is a slow version that clearly shows the status bar flashing the previous color: Android.slow.mp4While I couldn't find an official bug report for this, the problem of white flashes seems to be a thing with Chrome. I couldn't fathom how the code change would cause this visual bug, though. Especially, since the problem does not occur on iOS. |
Are there any other techniques for changing the status bar color that might prevent the flash from happening @dnlfrst ? |
None that I would be aware of, at least. |
On Chrome, why isn't the top a dark dark green to match the body? Like when the overlay is open, the top matches the overlay color... so when the overlay is not open, why can't we match the background color? |
That's a good question! I wasn't sure about this myself, yet. On iOS, Safari automatically adapts the status color to the background color of the app. Google Chrome on Android does not do so, though. Hence, I have applied the following patch (929f85e) to this PR: diff --git a/src/components/CustomStatusBar/index.web.js b/src/components/CustomStatusBar/index.web.js
new file mode 100644
index 0000000000..56799ecf32
--- /dev/null
+++ b/src/components/CustomStatusBar/index.web.js
@@ -0,0 +1,16 @@
+import React from 'react';
+import {StatusBar} from 'react-native';
+import themeColors from '../../styles/themes/default';
+
+export default class CustomStatusBar extends React.Component {
+ componentDidMount() {
+ StatusBar.setBarStyle('light-content', true);
+
+ // Match the default status bar color to the app's background color.
+ document.querySelector('meta[name=theme-color]').content = themeColors.appBG;
+ }
+
+ render() {
+ return <StatusBar />;
+ }
+}
diff --git a/src/components/Modal/index.web.js b/src/components/Modal/index.web.js
index 2ee534457e..79d5751403 100644
--- a/src/components/Modal/index.web.js
+++ b/src/components/Modal/index.web.js
@@ -3,9 +3,10 @@ import withWindowDimensions from '../withWindowDimensions';
import BaseModal from './BaseModal';
import {propTypes, defaultProps} from './modalPropTypes';
import * as StyleUtils from '../../styles/StyleUtils';
+import themeColors from '../../styles/themes/default';
const Modal = (props) => {
- const setStatusBarColor = (color = '') => {
+ const setStatusBarColor = (color = themeColors.appBG) => {
if (!props.fullscreen) {
return;
} It sets the default status bar color to match the app's background color. This applies to Android.mp4 |
Oh, that's pretty good! I think that flash is much less noticeable now, and kudos @shawnborton for asking the right question! That never even occurred to me. |
I tested it on Android briefly and I think it looks good and I'm OK merging this. @eVoloshchak do you have time to go through the checklist and other platforms today? |
Yes, I'll do it in a couple of hours |
Yeah, I 100% agree with that sentiment. It feels odd that iOS has the different color status bar from the rest of the page. |
Got it. Hmm, what can we do to avoid that? |
Not sure, we need to somehow detect the background color of the current screen. But I can't think of a non-hacky way to do this, probably needs discussing on slack |
Do you guys still want me to work on this or will you take care of this internally? |
Hmm yeah, so maybe this is trickier than we thought and relates back to the big status bar discussion we were having previously, cc @Julesssss @vitHoracek @JmillsExpensify where did we land with that one? |
We agreed to merge the PR and have the status bar show as a different colour until a better solution can be found. I'm working on that but it is far lower priority than docs and other WhatsApp quality issues. The screenshots actually show how the app functions on As for why the status bar has 'changed' on iOS, this is because the login screen background color is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'regressions' are known, I think we can go ahead with this change.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2022-12-07.at.12.50.32.movMobile Web - ChromeScreen_Recording_20221207-124529_Chrome.mp4Mobile Web - SafariScreen.Recording.2022-12-07.at.12.46.43.movDesktopScreen.Recording.2022-12-07.at.12.49.21.moviOSScreen.Recording.2022-12-07.at.12.47.28.movAndroidScreen_Recording_20221207-124618_New.Expensify.mp4 |
@dnlfrst, could you please add
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well!
Done that! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by @chiragsalian in version: 1.2.38-6 🚀
|
@eVoloshchak
@tgolen
Details
Previously, the status bar color did not match the backdrop of a modal on Safari. This pull request fixes this issue by changing the status bar color as soon as a modal opens.
Fixed Issues
$ #12156
$ #12156 (comment)
Tests
By design, these steps only apply on iOS / Safari and Android / Chrome since the issue never appeared on iOS / native and Android / native. The remaining platforms do not offer a comparable context menu.
Offline tests
See the steps from above.
QA Steps
See the steps from above.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Screenshots/Videos
Web
Not applicable.
Mobile Web - Chrome
Android.webm
Mobile Web - Safari
iOS.MP4
Desktop
Not applicable.
iOS
Not applicable.
Android
Not applicable.