react-native-form-generator icon indicating copy to clipboard operation
react-native-form-generator copied to clipboard

Unable to style PickerField's Picker and PickerItem component

Open nyanofthemoon opened this issue 9 years ago • 3 comments

Unable to style the react-native Picker and PickerItem components. I attempted to use the pickerWrapper, but only the backgroundColor can be changed this way and not the font family nor font size. Thanks!

nyanofthemoon avatar Sep 09 '16 17:09 nyanofthemoon

pickercomponent_ios_js

nyanofthemoon avatar Sep 09 '16 17:09 nyanofthemoon

I believe you're looking for labelStyle prop.

screen shot 2016-10-17 at 5 20 44 pm

abologna-r7 avatar Oct 17 '16 23:10 abologna-r7

For anyone else hitting this; I found that I needed to patch PickerComponent.ios.js#99 to include the itemStyle property for the RN Picker to style its items. Note that I used the valueStyle property because it worked for me but could easily have added another style prop or used labelStyle.

let picker = <Picker ref='picker'
        {...this.props.pickerProps}
        selectedValue={this.state.value}
        onValueChange={this.handleValueChange.bind(this)}
        mode='dropdown'
        **itemStyle={this.props.valueStyle}**
        >

I've also got a bunch of other patches that fix various iOS and android style and functional issues on my fork -- I have not processed them into a coherent PR yet and probably won't given that there's no activity on the outstanding PRs, one of which may conflict with mine.... but sharing it here in case others need them.

dchersey avatar May 27 '20 16:05 dchersey