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

116
Vistas
How to clear dynamically added TextInputs in react native

I'm having a bit of an issue resetting my TextInputs after submitting because they were added dynamically.

I currently have my js code like this

                    <FlatList
                      data={this.state.items}
                      keyExtractor={(item, index) => item.party_id}
                      renderItem={({item}) =>
                        <View style={styles.InputBox}>
                            <TouchableOpacity style={styles.InputPartyLabel}><Text>{item.party_name}</Text></TouchableOpacity>
                            <TextInput
                                ref={input => { this.textInput = input }}
                                style={styles.Input}
                                placeholder="Number of votes"
                                onChangeText={result => this.collateResults(item.party_name, result)}
                                placeholderTextColor="#bbb"
                                autoCapitalize='none'
                                underlineColorAndroid='transparent'
                              />
                        </View> } />

I added this ref={input => { this.textInput = input }} but it only clears the last one.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need this.textInput to be an array. And then push to that array when setting the refs

<TextInput
                                ref={input => this.textInput.push(input)}
                                style={styles.Input}
                                placeholder="Number of votes"
                                onChangeText={result => this.collateResults(item.party_name, result)}
                                placeholderTextColor="#bbb"
                                autoCapitalize='none'
                                underlineColorAndroid='transparent'
                              />
about 4 years ago · Juan Pablo Isaza Denunciar
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