-
Notifications
You must be signed in to change notification settings - Fork 3k
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
apply dark theme throughout the app #13874
Conversation
@grgia @aimane-chnaif 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] |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Safarimsafari.mp4Desktopdesktop.moviOSios.mp4 |
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.
LGTM and tests well
cc: @grgia
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.
Code looks good! I think we should add a comment for clarification and then we should be good to go
@@ -64,6 +65,7 @@ public ReactNativeHost getReactNativeHost() { | |||
@Override | |||
public void onCreate() { | |||
super.onCreate(); | |||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); |
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.
Let's add a comment here about why we need to set android to night mode in addition to setting the BaseAppTheme.
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.
Theme.AppCompat.Light.NoActionBar
-> Theme.AppCompat.NoActionBar
is enough to change app theme to dark which applied to splash screen, keyboard empty space and scroll indicator color, etc. But this doesn't involve navigation bar (I tested and confirmed).
That's why I did below change as well to make navigation bar color dark even though device theme is light, which fixes #13087.
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
What will be a good comment here do you suggest?
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.
Always use dark (night) theme so it doesn't depend on system theme.
Something like this?
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.
How about Use night (dark) mode so native UI defaults to dark theme.
?
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.
@grgia done
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.
Looks good!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
This PR is causing a To fix it we need to set color to colorBackgroundFloating to fix the issue in styles.xml because applying background color dark to android app also causes Modals to be Dark. As it is a
After Fix :- WhatsApp.Video.2023-01-03.at.11.13.45.AM.1.mp4 |
@grgia @aimane-chnaif This PR caused #13951 but this came from lack of dark mode support in react-native-picker-select package (last publish was 2 years ago and not maintained). So in our app, we're still using light theme for picker even though entire app is dark theme. cc: @shawnborton This should be exact looking in dark mode for android: dark.theme.mp4For iOS, this package doesn't support dark mode yet. There's a PR for this but it seems no one cares about it. For web, dark mode is still not supported in react-native-web Picker. That's why @luacmartins added code here: App/src/components/Picker/index.js Lines 171 to 172 in 466b027
So the solution is to set picker text color to white in android (like video above), and still keep light mode (white background, dark text) in all other platforms. But eventually, we need to fix iOS and web too to apply dark theme to picker, either customizing this package or replace with other good package. |
That makes sense to me, but curious what our engineers think as well. |
While I agree that @0xmiroslav's proposal appears to make the picker look correct in dark mode, if we're using a light mode picker in every other version of the app, then I think we should do the same for Android till we can update it everywhere, which would make @syedsaroshfarrukhdot proposal the appropriate solution. And as @jasperhuangg pointed out in blocker issue, this is a visual quirk, not a functional break, so it's not a blocker, which gives us a bit of breathing room to discuss it. |
🚀 Deployed to production by @roryabraham in version: 1.2.47-0 🚀
|
Details
force dark theme on all platforms
Fixed Issues
$ #12914
PROPOSAL: #12914 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting 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)ScrollView
component to make it scrollable when more elements are added to the page.Screenshots/Videos
Web
Chrome (Mac):

Chrome (Windows) (thumb active):

Chrome (Windows) (thumb inactive):

Firefox (Windows):

Safari (Mac):

Mobile Web - Chrome
Mobile Web - Safari
Desktop
desktop.mov
iOS
Android