-
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
Add a color to the options in the picker when using Windows #13174
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
|
||
// Windows will reuse the text color of the select for each one of the options | ||
// so we might need to color accordingly so it doesn't blend with the background. | ||
if (getOperatingSystem() === CONST.OS.WINDOWS) { |
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.
NAB I think that other platforms were unaffected by the dark theme change and override these styles, so checking for Windows might be unnecessary. That being said, it doesn't hurt to do so.
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.
Yeah, that is what I thought and I was going to leave it without it but I didn't want to cause a regression.
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.
Makes sense. Let's keep it this way
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.
Having the OS check here is the same as having a platform-specific check and our README shares pretty strong opinions about adding them:
Accordingly, don't even bother writing a platform-specific code block because you're just going to need to undo it.
Can you please take the time to remove this? My guess is the same as Carlos's and that having the color there isn't going to affect the other platforms, but let's be sure to test for regressions.
this.items = _.map(this.items, item => ( | ||
{ | ||
...item, | ||
color: '#002140', |
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.
We should add this as a CONST
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.
Ideally, it should be in the themes but Shawn said we don't have this one yet. DO you want me to add it as constant no matter what?
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.
It seems like we have a colors switch PR coming up, based on this comment. I'll ping Georgia to clean this up once we deprecate this other colors.
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 would love it if this was moved to a constant or maybe to our style.variables
. Anytime we leave code like this, even temporarily, that's opening chances for contributors to see it and copy it, assuming it's a good pattern to follow.
From what I've heard, we are not moving quickly on that theme-switcher, and even when they do, it will be hard to find this and fix it, so it could live here for a long time if someone forgets about it.
|
Co-authored-by: Carlos Martins <cmartins@expensify.com>
@rushatgabhane @madmax330 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] |
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
Reviewer Checklist
Screenshots/VideosMobile Web - Chrome![chrome](https://user-images.githubusercontent.com/22219519/204685166-7cb82ccf-4938-42ec-912c-e368c8191279.png)iOS![ios](https://user-images.githubusercontent.com/22219519/204685180-82f36625-5f66-4f07-ba65-41e3f4147034.png) |
if (getOperatingSystem() === CONST.OS.WINDOWS) { | ||
this.placeholder = _.isEmpty(this.placeholder) ? {} : { | ||
...this.placeholder, | ||
color: '#002140', |
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.
For future reference, in case someone stumbles on this PR, we didn't create a constant for this because we'll have to clean it up anyways when the light theme is up soon.
Checklists are complete! I'll merge this to fix the blocker! |
Add a color to the options in the picker when using Windows (cherry picked from commit df97c3c)
…-13174 🍒 Cherry pick PR #13174 to staging 🍒
🚀 Cherry-picked to staging by @luacmartins in version: 1.2.33-7 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by @luacmartins in version: 1.2.33-7 🚀
|
🚀 Deployed to production by @luacmartins in version: 1.2.33-7 🚀
|
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.
Hi! Sorry to stop by here after-the-fact, but I did see a few things that I wanted to point out.
On a semi-related note, since windows is not a supported platform, this should have been a feature
and not a bug
.
} | ||
|
||
componentDidMount() { | ||
this.setDefaultValue(); | ||
|
||
// Windows will reuse the text color of the select for each one of the options |
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.
It's probably not very ideal to have this logic here and I think the constructor is a better place for it. The reason is, componentDidMount()
isn't run until after it's rendered, but we want those values to be there before things are rendered.
|
||
// Windows will reuse the text color of the select for each one of the options | ||
// so we might need to color accordingly so it doesn't blend with the background. | ||
if (getOperatingSystem() === CONST.OS.WINDOWS) { |
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.
Having the OS check here is the same as having a platform-specific check and our README shares pretty strong opinions about adding them:
Accordingly, don't even bother writing a platform-specific code block because you're just going to need to undo it.
Can you please take the time to remove this? My guess is the same as Carlos's and that having the color there isn't going to affect the other platforms, but let's be sure to test for regressions.
this.items = _.map(this.items, item => ( | ||
{ | ||
...item, | ||
color: '#002140', |
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 would love it if this was moved to a constant or maybe to our style.variables
. Anytime we leave code like this, even temporarily, that's opening chances for contributors to see it and copy it, assuming it's a good pattern to follow.
From what I've heard, we are not moving quickly on that theme-switcher, and even when they do, it will be hard to find this and fix it, so it could live here for a long time if someone forgets about it.
Sure, I can make all those changes, sorry about that! |
I also brought up in #expensify-open-source the discussion about not supporting Windows since I find it interesting taking into account that is the most used OS. |
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀
|
Details
Changing the colors of the items was really tricky since the component does not offer that possibility, I ended up fixing it by doing this: lawnstarter/react-native-picker-select#440
Fixed Issues
$ #13127
PROPOSAL: N/A
Tests
On a Windows OS:
On a Mac OS:
Offline tests
QA Steps
On a Windows OS:
On a Mac OS:
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)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### 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
have been tested & I retested again)/** 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 - Mac
![Monosnap Monosnap 2022-11-29 20-01-06](https://user-images.githubusercontent.com/6474442/204681959-b484fb09-c54a-411e-8d3a-96368f13dbd8.png)Web - Windows
![image](https://user-images.githubusercontent.com/6474442/204683810-f3c0a17d-043f-4b0e-9193-9975cfd7bd69.png)Mobile Web - Chrome
![chrome](https://user-images.githubusercontent.com/22219519/204686485-85fa6965-d42d-4c73-bb94-7e0e0644f4f5.png)Web - Safari
![image](https://user-images.githubusercontent.com/6474442/204682103-29191087-3dd7-4dc9-b910-c2132173edaa.png)Desktop
![Monosnap Monosnap 2022-11-29 20-19-23](https://user-images.githubusercontent.com/6474442/204684138-ae1ebf52-5675-4ca3-9941-cfd23e71841e.png)iOS
Android
![image](https://user-images.githubusercontent.com/6474442/204686193-6bc619fd-040d-46d3-899a-5a607bead4eb.png)