Problem with Picker in android (text of the selected item)

Hi how are you? I am having a problem with the picker (only in android). In Iphone, i dont have any problem.
When i select an item, in android doesn’t update the text in the combobox (but the object is selected ok).
I attach the code:
<View style={[Styles.PickerSelect, { width: “70%” }]}>

                    <Picker

                      headerBackButtonText="Atras"

                      iosHeader="Seleccionar"

                      selectedValue={this.state.articulo}

                      placeholder={this.state.articulo}

                      onValueChange={this.getDatosLineas.bind(this)}

                    >

                      {this.state.articulos == null

                        ? null

                        : this.state.articulos.map((item, i) => {

                            return (

                              <Picker.Item

                                key={i}

                                value={i}

                                label={item.nom_articulo}

                              />

                            );

                          })}

                    </Picker>

                  </View>

I attach the photo of the example:
In 1- When i enter to the section, i have the picker with this text and value.
In 2- I select the picker, and i select another item (for example “ORUJO DE UVAS BLANCAS”)
In 3- In android, the text isn’t be updated. But the object is the selected…

image

I repeat, in ios i dont have this problem.

  • Expo SDK: 36.0.0

Thanks!

@Hi @calejandro_ateitis5, I’m fine, and you?

import { Picker } from "react-native" is deprecated, you should use @react-native-community/picker, if you aren’t already.

Knowing this, could you post some more code about what imports are you using?
and:
version of: @react-native-community/picker
version of: expo

If you can, create an snack here: https://snack.expo.io/
This way we can help you more.

Edit: created this for you start: Using Picker - Snack

Hi Victor, thank you for your help!
I am using this import:
import { Icon, Picker, CheckBox } from “native-base”;

Perhaps …is it the problem?

I attach the versions:
“native-base”: “^2.13.8”,
“expo”: “~36.0.0”,

Thank you very much!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.