Skip to content
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

Closed
wants to merge 7 commits into from
Closed

Fix iOS Picker Item Colors #11260

wants to merge 7 commits into from

Conversation

JakeDawkins
Copy link
Contributor

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.

Test plan

I visually tested the Colorful Pickers example in UIExplorer. Those picker Items pass in a color prop.

dec-01-2016 22-07-46

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

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @spicyj and @adierkens to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Dec 2, 2016
items.push({
value: child.props.value,
label: child.props.label,
textColor: processColor(child.props.color)});
Copy link
Collaborator

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

Copy link
Contributor

@janicduplessis janicduplessis left a 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) {
Copy link
Contributor

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;

@janicduplessis
Copy link
Contributor

@facebook-github-bot shipit

robclouth pushed a commit to robclouth/react-native that referenced this pull request Dec 7, 2016
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
mkonicek pushed a commit that referenced this pull request Dec 12, 2016
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
DanielMSchmidt pushed a commit to DanielMSchmidt/react-native that referenced this pull request Jan 4, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants