mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08:00
[fix] Picker.Item support for 'color' prop
Not well supported by browsers. Fix #810
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -20,7 +20,7 @@ const PickerExample = props => (
|
||||
);
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
rootl: {
|
||||
root: {
|
||||
alignItems: 'flex-start'
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user