Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give fontSize to react native android picker?

Tags:

react-native

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>
like image 863
Harinder88 Avatar asked Sep 20 '16 03:09

Harinder88


2 Answers

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'}/>
like image 77
Anukul Rawat Avatar answered Sep 20 '22 17:09

Anukul Rawat


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

const styles = StyleSheet.create ({
selectInput: {
    transform: [
      { scaleX: 0.9 }, 
      { scaleY: 0.9 },
   ],
 },
})
like image 40
Yinka Avatar answered Sep 19 '22 17:09

Yinka