-
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
31695 theme switching composer #31831
31695 theme switching composer #31831
Conversation
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.
Left comments.
added some fixes |
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, just a few minor naming comments :)
import ContainerComposeStyles from './types'; | ||
|
||
const containerComposeStyles: ContainerComposeStyles = [styles.textInputComposeSpacing]; | ||
const containerComposeStyles: ContainerComposeStyles = (stylesObject) => [stylesObject.textInputComposeSpacing]; |
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.
can we rename this to just styles
? :)
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.
@lukemorawski would you be able to update with this change today?
import ContainerComposeStyles from './types'; | ||
|
||
// We need to set paddingVertical = 0 on web to avoid displaying a normal pointer on some parts of compose box when not in focus | ||
const containerComposeStyles: ContainerComposeStyles = [styles.textInputComposeSpacing, {paddingVertical: 0}]; | ||
const containerComposeStyles: ContainerComposeStyles = (stylesObject) => [stylesObject.textInputComposeSpacing, {paddingVertical: 0}]; |
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.
same here
|
||
type ContainerComposeStyles = ViewStyle[]; | ||
type ContainerComposeStyles = (stylesObject: typeof styles) => ViewStyle[]; |
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.
same here
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
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.
Thanks for the changes :) LGTM
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@@ -4,7 +4,8 @@ import {StyleSheet} from 'react-native'; | |||
import _ from 'underscore'; | |||
import RNTextInput from '@components/RNTextInput'; | |||
import * as ComposerUtils from '@libs/ComposerUtils'; | |||
import themeColors from '@styles/themes/default'; | |||
import {useTheme} from '@styles/themes/useTheme'; |
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.
I'm seeing the following error after I synced with main
Shouldn't this be
import useTheme from '@styles/themes/useTheme';
There doesn't seem to be a named export called useTheme
here: src/styles/themes/useTheme.ts
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.
I'm seeing the same thing. @lukemorawski why are there no testing steps and no screenshots on this PR?
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.
I'm seeing the same thing. @lukemorawski why are there no testing steps and no screenshots on this PR?
Maybe because QA team cannot test this PR without switching to light theme which is not enabled yet.
But it would have been better to test in all platforms though this is very simple PR. Or have C+ review and test - should the bug have been caught earlier before merge.
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.
sorry, wrong auto import! fixed now
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.
Is there a PR that fixes this already?
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.
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.
ah perfect, thanks!
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.
I understand this PR doesn't enable or change any functionality, but it does refactor theming in several components. We should always test these changes even if the test is a super simple "view each component and verify styling is still working". That would have been enough to catch small errors. QA regression testing should catch anything more complex.
@lukemorawski please don't cut corners and test on all platforms even for the simple stuff. I know it's annoying, but it's worth the time 🙇.
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.
should have catched this in the review as well, sorry for that! 🫠
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.
totally agree, sorry again for that
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.6-2 🚀
|
Details
This PR refactors the code to use dynamic theme/styling object, by using useThemeStyles and useTheme hooks in favor of static imports, to enable app wide theme switching.
Fixed Issues
$ #31695
PROPOSAL: no proposal
Tests
apply this diff to test light theme
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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)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.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
no screenshotsAndroid: mWeb Chrome
no screenshots
iOS: Native
no screenshots
iOS: mWeb Safari
no screenshots
MacOS: Chrome / Safari
no screenshots
MacOS: Desktop
no screenshots