Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/components/Picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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.

};
this.items = _.map(this.props.items, item => (
{
...item,
color: variables.pickerOptionsTextColor,
}
));
}

componentDidMount() {
Expand Down Expand Up @@ -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}))}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB, but guessing there is no way to pass the color to the picker component instead of with each option? Seems a bit weird to have to decorate the items with the color property if they are all going to be the same color.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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}
Expand Down
1 change: 1 addition & 0 deletions src/styles/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default {
greenDefaultButtonHover: '#2C6755',
greenDefaultButtonPressed: '#467164',
greenDefaultButtonDisabled: '#8BA69E',
midnight: '#002140',

// DEPRECATED COLORS. Do not reference these colors. Will be deleted in color switch PR.
gray1: '#FAFAFA',
Expand Down
1 change: 1 addition & 0 deletions src/styles/themes/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const darkTheme = {
heroCard: colors.blue,
uploadPreviewActivityIndicator: colors.greenHighlightBackground,
checkBox: colors.green,
pickerOptionsTextColor: colors.midnight,
};

const oldTheme = {
Expand Down
1 change: 0 additions & 1 deletion src/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@ export default {
INACTIVE_LABEL_TRANSLATE_Y: getValueUsingPixelRatio(16, 21),
sliderBarHeight: 8,
sliderKnobSize: 26,
pickerOptionsTextColor: '#002140',
};