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

150
Views
Cómo verificar dónde existe la longitud de la matriz en la lista plana reactiva

Necesito verificar dónde existe la matriz de datos en el bucle de lista plana,

ejemplo

 const renderItem = ({ item }) => ( <TouchableOpacity> <Text>{item.name}<Text> <Text>i Want to show this Text only in array 2,4,6,8,...<Text> </TouchableOpacity> ); <FlatList data={product} renderItem={renderItem} keyExtractor={item => item.id} ListEmptyComponent={(<EmptyData />)} style={{ flex: 1, marginBottom: 50 }} />

Necesito mostrar el texto pero solo en la longitud de la matriz 2,4,6,8,..., ya intenté usar el producto [2] pero el texto muestra cada bucle

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

0

Supongo que desea que el texto se muestre cuando la longitud del product sea pareja. Para eso puedes usar el siguiente código:

 const renderItem = ({ item }) => ( <TouchableOpacity> <Text>{item.name}<Text> {(product.length % 2) === 0 && <Text>i Want to show this Text only in array 2,4,6,8,...<Text>} </TouchableOpacity> );

Más información sobre el operador % restante

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!