Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

315
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda