Skip to content

Commit 1aec803

Browse files
committed
[fix] Picker.Item support for 'color' prop
Not well supported by browsers. Fix #810
1 parent 2050730 commit 1aec803

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

packages/react-native-web/src/exports/Picker/PickerItem.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export default class PickerItem extends Component<Props> {
1919
};
2020

2121
render() {
22-
const { label, testID, value } = this.props;
23-
return createElement('option', { testID, value }, label);
22+
const { color, label, testID, value } = this.props;
23+
const style = { color };
24+
return createElement('option', { style, testID, value }, label);
2425
}
2526
}

website/storybook/1-components/Picker/PickerScreen.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,16 @@ const PickerScreen = () => (
9898
<Description>Individual selectable item in a Picker.</Description>
9999

100100
<Section title="Props">
101-
<DocItem name="label" typeInfo="string" description="Text to display for this item" />
101+
<DocItem
102+
name="color"
103+
typeInfo="?color"
104+
description="Color of the item label. (Limited by browser support.)"
105+
/>
106+
107+
<DocItem name="label" typeInfo="string" description="Text to display for this item." />
108+
102109
<DocItem name="testID" typeInfo="?string" />
110+
103111
<DocItem
104112
name="value"
105113
typeInfo="?number | string"

website/storybook/1-components/Picker/examples/PickerExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const PickerExample = props => (
2020
);
2121

2222
const styles = StyleSheet.create({
23-
rootl: {
23+
root: {
2424
alignItems: 'flex-start'
2525
}
2626
});

0 commit comments

Comments
 (0)