Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

308
Vistas
Invalid attempt to spread non-iterable instance on getting each value from picker

So I have a picker that is mapped based on items from the database and I'm trying to get the value from each picker to send it back to the database. So far I have done this:

this.state = {
            rating: null,
            arrRating:[]
        }

renderQuestion(){
        let panels = []
          this.props.companyQuestion.map((key, index) => {
            panels.push(
                <View key={index} style={styles.panel}>
                    <View style={styles.panelRow}>
                        <Text style={styles.panelText}>{key.question}</Text>
                        <Picker
                        selectedValue={this.state.rating}
                        style={styles.panelText}
                        onValueChange={(itemValue, itemIndex) =>
                            this.setState({ rating: itemValue, 
                                arrRating:[...this.state.arrRating.push(this.state.rating)] })
                        }>
                        <Picker.Item label="Score" value="0" />
                        <Picker.Item label="1" value="1" />
                        <Picker.Item label="2" value="2" />
                        <Picker.Item label="3" value="3" />
                        <Picker.Item label="4" value="4" />
                        <Picker.Item label="5" value="5" />
                        </Picker> 
                    </View>
                </View>
            );
          })
        return panels;
    }

But I am having an error when I picked an item in the picker. It says

TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda