Reputation: 520
I have Picker from 'react-native'. Picker.Item there are :"Monday, Tuesday, Wednesday etc". And I want to set up text properties. Like fontSize:20, color:"red" etc.
In Picker component we can use style. But there I can't change properties of text. Also I try to use ItemStyle={{color:"red"}}. But nothing change
<Picker
style={{ flex: 1 }}
selectedValue={this.props.shift}
onValueChange={value => this.props.employeeUpdate({ prop:
'shift', value })}
>
<Picker.Item label="Monday" value="Monday" />
<Picker.Item label="Thuesday" value="Thuesday" />
<Picker.Item label="Wednesdady" value="Wednesdady" />
<Picker.Item label="Thursday" value="Thursday" />
<Picker.Item label="Friday" value="Friday" />
<Picker.Item label="Saturday" value="Saturday" />
<Picker.Item label="Sunday" value="Sunday" />
</Picker>
Upvotes: 0
Views: 79
Reputation: 4489
As said by the docs, itemStyle
works only on iOS and has to be used on the global Picker component like:<Picker itemStyle={styles.pickerItemStyle}
.
I'm pretty sure using the classic react-native Picker
you can only change the color of an item using the prop color
.
These are the only props usable from Picker.item
as said by the react-native docs: https://facebook.github.io/react-native/docs/picker-item
Upvotes: 1