Quantcast
Channel: React Native Picker - Android issue on loading - Stack Overflow
Viewing all articles
Browse latest Browse all 2

React Native Picker - Android issue on loading

$
0
0

i am using the React Native Picker and I am having problems on loading the picker values on Android.

This is my component code:

    render() {
    return (
      <View style={styles.pickerContainer}>
        <Picker
          style={{width: 100}}
          selectedValue={"10"}
          mode="dialog">
          {this._renderPickItems()}
        </Picker>
      </View>
    )
  }

  _renderPickItems() {
    const PickerItem = Picker.Item

    return this.state.minutesList.map((value) => (
      <PickerItem label={`${value} min`} value={value} key={`minutes_${value}`} />
    ))
  }

When I run my app on Android, the elements of the Picker are not being shown on the screen for some reason (minutesList is an Array of numbers), in the other hand if I ran the same code on iOS, the items are being shown correctly.

Another thing is if I add Picker.Item directly into the Picker (like the Picker doc example) it works like expected, but i do not want to add 99 lines for each element.

Why the function returing the Picker.Items works on iOS and not Android? Maybe there is something basic missing and I do not know what it is.

Some images on the problem: iOS works like expected

Thanks for the help.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images