13

How can I give fontSize to picker (android)? I tried to give but it's not working

<Picker
  style={{fontSize:20}}
  selectedValue={this.state.language}
  onValueChange={(lang) => this.setState({language: lang})}>
  <Picker.Item label="Java" value="java" />
  <Picker.Item label="JavaScript" value="js" />
</Picker>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Harinder88
  • 284
  • 3
  • 5
  • 10
  • 1
    Possible duplicate of [How to style the standard react-native android picker?](https://stackoverflow.com/questions/38921492/how-to-style-the-standard-react-native-android-picker) – Cœur Feb 21 '18 at 08:02

6 Answers6

9

At the moment, you can't. This is what the official documentation says here

itemStyle itemStylePropType

Style to apply to each of the item labels.

But this only works on iOS

On Android, you'll have to wait for them to implement it (or maybe write a PR for them :))

G. Hamaide
  • 7,078
  • 2
  • 36
  • 57
5

This does the trick perfectly well. Just change the scale value.

const styles = StyleSheet.create ({
selectInput: {
    transform: [
      { scaleX: 0.9 }, 
      { scaleY: 0.9 },
   ],
 },
})
Yinka
  • 1,741
  • 4
  • 15
  • 23
2

They didn't add support to change the font size that way. Here is a workaround that I don't like but it seems to be the only thing that works. Here is an example.

 <Picker 
      mode="dropdown"
      selectedValue="en"
      style={{width: 110, height: 50}} 
      itemStyle={{height: 50, transform: [{ scaleX: 1 }, { scaleY: 1 }]}}>

      <Picker.Item value="en" label="English"  />
      <Picker.Item value="es" label="Español" />
    </Picker>
jerryurenaa
  • 3,863
  • 1
  • 27
  • 17
2

To anyone still searching, Here's what I found:-

Enter the 'fontSize' style property individually to every picker.item.

<Picker.Item style={{fontSize:12}} label={'AnyValueLabel'} value={'AnyValueName'}/>
0

Normal for Android

  {drinksArr.map((val, index) => (
 <Picker.Item
                style={{
                  fontSize: 30,
                  backgroundColor: Colors.Black,
                }}
                fontFamily="font_family"
                color={Colors.Gold}
                label={val.title}
                value={val.title}
                key={index}
              />
Salman
  • 191
  • 9
-2

Under the documentation; all what i found is that:

itemTextStyle={{fontSize: 15}}
activeItemTextStyle={{fontSize: 18, fontWeight: 'bold'}}

Which works for me.

Nick
  • 138,499
  • 22
  • 57
  • 95
  • 1
    FYI this doesn't work in android (not tested in iOS). also I don't see any reference to these props in the docs – Apolo Oct 10 '19 at 13:01