-
Notifications
You must be signed in to change notification settings - Fork 24.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
Fix iOS Picker Item Colors #11260
Fix iOS Picker Item Colors #11260
Conversation
By analyzing the blame information on this pull request, we identified @spicyj and @adierkens to be potential reviewers. |
items.push({ | ||
value: child.props.value, | ||
label: child.props.label, | ||
textColor: processColor(child.props.color)}); |
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.
style nit: });
should be on a newline, indented to the same level as items
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.
Just one small change then this LGTM. Thanks for working on this!
@@ -86,7 +86,13 @@ - (UIView *)pickerView:(UIPickerView *)pickerView | |||
} | |||
|
|||
label.font = _font; | |||
label.textColor = _color; | |||
|
|||
if ([_items[row] objectForKey:@"textColor"] == nil) { |
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 we can simplify this a bit with by using the ?:
operator.
label.textColor = [RCTConvert UIColor:_items[row][@"textColor"]] ?: _color;
@facebook-github-bot shipit |
Summary: I want to resolve facebook#11170 by passing the `color` prop from `PickerIOS.Item` to its implementation. In `RCTPicker.m`, the label.textColor was already being set and used, but there was nothing referencing the past prop. I passed the prop to the implementation, checked if it exists, and if not, set the default color, like before. I visually tested the **Colorful Pickers** example in UIExplorer. Those picker `Item`s pass in a `color` prop. ![dec-01-2016 22-07-46](https://cloud.githubusercontent.com/assets/9259509/20821696/ae45d704-b812-11e6-9720-0045d6c0bcd4.gif) The basic picker does not pass the color prop to the picker `Item`, and there are no errors. Basic functionality is still in tact: ![dec-01-2016 22-09-35](https://cloud.githubusercontent.com/assets/9259509/20821730/ee544f74-b812-11e6-9294-a1b45e78d9f7.gif) Closes facebook#11260 Differential Revision: D4272370 fbshipit-source-id: 5fa33c40526dda59ca2ab527c31351bcd27e5cf3
Summary: I want to resolve #11170 by passing the `color` prop from `PickerIOS.Item` to its implementation. In `RCTPicker.m`, the label.textColor was already being set and used, but there was nothing referencing the past prop. I passed the prop to the implementation, checked if it exists, and if not, set the default color, like before. I visually tested the **Colorful Pickers** example in UIExplorer. Those picker `Item`s pass in a `color` prop. ![dec-01-2016 22-07-46](https://cloud.githubusercontent.com/assets/9259509/20821696/ae45d704-b812-11e6-9720-0045d6c0bcd4.gif) The basic picker does not pass the color prop to the picker `Item`, and there are no errors. Basic functionality is still in tact: ![dec-01-2016 22-09-35](https://cloud.githubusercontent.com/assets/9259509/20821730/ee544f74-b812-11e6-9294-a1b45e78d9f7.gif) Closes #11260 Differential Revision: D4272370 fbshipit-source-id: 5fa33c40526dda59ca2ab527c31351bcd27e5cf3
Summary: I want to resolve facebook#11170 by passing the `color` prop from `PickerIOS.Item` to its implementation. In `RCTPicker.m`, the label.textColor was already being set and used, but there was nothing referencing the past prop. I passed the prop to the implementation, checked if it exists, and if not, set the default color, like before. I visually tested the **Colorful Pickers** example in UIExplorer. Those picker `Item`s pass in a `color` prop. ![dec-01-2016 22-07-46](https://cloud.githubusercontent.com/assets/9259509/20821696/ae45d704-b812-11e6-9720-0045d6c0bcd4.gif) The basic picker does not pass the color prop to the picker `Item`, and there are no errors. Basic functionality is still in tact: ![dec-01-2016 22-09-35](https://cloud.githubusercontent.com/assets/9259509/20821730/ee544f74-b812-11e6-9294-a1b45e78d9f7.gif) Closes facebook#11260 Differential Revision: D4272370 fbshipit-source-id: 5fa33c40526dda59ca2ab527c31351bcd27e5cf3
I want to resolve #11170 by passing the
color
prop fromPickerIOS.Item
to its implementation.In
RCTPicker.m
, the label.textColor was already being set and used, but there was nothing referencing the past prop. I passed the prop to the implementation, checked if it exists, and if not, set the default color, like before.Test plan
I visually tested the Colorful Pickers example in UIExplorer. Those picker
Item
s pass in acolor
prop.The basic picker does not pass the color prop to the picker
Item
, and there are no errors. Basic functionality is still in tact: