[fix] Picker.Item support for 'color' prop

Not well supported by browsers.

Fix #810
This commit is contained in:
Nicolas Gallagher
2018-04-08 11:43:20 -07:00
parent 2050730b77
commit 1aec803086
3 changed files with 13 additions and 4 deletions

View File

@@ -19,7 +19,8 @@ export default class PickerItem extends Component<Props> {
};
render() {
const { label, testID, value } = this.props;
return createElement('option', { testID, value }, label);
const { color, label, testID, value } = this.props;
const style = { color };
return createElement('option', { style, testID, value }, label);
}
}

View File

@@ -98,8 +98,16 @@ const PickerScreen = () => (
<Description>Individual selectable item in a Picker.</Description>
<Section title="Props">
<DocItem name="label" typeInfo="string" description="Text to display for this item" />
<DocItem
name="color"
typeInfo="?color"
description="Color of the item label. (Limited by browser support.)"
/>
<DocItem name="label" typeInfo="string" description="Text to display for this item." />
<DocItem name="testID" typeInfo="?string" />
<DocItem
name="value"
typeInfo="?number | string"

View File

@@ -20,7 +20,7 @@ const PickerExample = props => (
);
const styles = StyleSheet.create({
rootl: {
root: {
alignItems: 'flex-start'
}
});