Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
Cómo borrar TextInputs agregados dinámicamente en reaccionar nativo

Tengo un pequeño problema al restablecer mis TextInputs después de enviarlos porque se agregaron dinámicamente.

Actualmente tengo mi código js como este

 <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> } />

Agregué este ref={input => { this.textInput = input }} pero solo borra el último.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Necesitas this.textInput para ser una matriz. Y luego empuje a esa matriz al configurar las referencias

 <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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!