-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Update picker items #13375
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
Update picker items #13375
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ import * as Expensicons from '../Icon/Expensicons'; | |
| import FormHelpMessage from '../FormHelpMessage'; | ||
| import Text from '../Text'; | ||
| import styles from '../../styles/styles'; | ||
| import variables from '../../styles/variables'; | ||
| import themeColors from '../../styles/themes/default'; | ||
| import pickerStyles from './pickerStyles'; | ||
|
|
||
| const propTypes = { | ||
|
|
@@ -108,14 +108,8 @@ class Picker extends PureComponent { | |
| // so we might need to color accordingly so it doesn't blend with the background. | ||
| this.placeholder = _.isEmpty(this.props.placeholder) ? {} : { | ||
| ...this.props.placeholder, | ||
| color: variables.pickerOptionsTextColor, | ||
| color: themeColors.pickerOptionsTextColor, | ||
| }; | ||
| this.items = _.map(this.props.items, item => ( | ||
| { | ||
| ...item, | ||
| color: variables.pickerOptionsTextColor, | ||
| } | ||
| )); | ||
| } | ||
|
|
||
| componentDidMount() { | ||
|
|
@@ -171,7 +165,9 @@ class Picker extends PureComponent { | |
| )} | ||
| <RNPickerSelect | ||
| onValueChange={this.onInputChange} | ||
| items={this.items} | ||
|
|
||
| // We add a text color to prevent white text on white background dropdown items on Windows | ||
| items={_.map(this.props.items, item => ({...item, color: themeColors.pickerOptionsTextColor}))} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB, but guessing there is no way to pass the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, but unfortunately I don't think there's a way around it or I couldn't find another solution. Here's the link to the lib docs.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries that's what I figured. I can't think of any reason why we might want to avoid this other than performance (though definitely not for the case this PR is fixing). But if performance is a concern we can find a more optimal way to recalculate things. Not concerned really. |
||
| style={this.props.size === 'normal' ? pickerStyles(this.props.isDisabled) : styles.pickerSmall} | ||
| useNativeAndroidPickerStyle={false} | ||
| placeholder={this.placeholder} | ||
|
|
||
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.
cc @shawnborton do we follow a particular naming convention for the these theme colors? I wasn't sure so wanted to ask if you're cool with the theme colors referring to specific things in the UI vs. more general stuff.
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 think that's okay? I don't feel strongly. Maybe @grgia has an opinion since she worked a lot on refactoring colors.