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

246
Vistas
Nested Array in react native

I want to design the above attached screen shot and I am getting a response in this format,

"data": {
  "personaldata": [
    {
      "name": "suresh",
      "time": [
        {
          "start": 12: 00,
          "end": 16: 00
        },
      ]
    },
  ]
}

I want to show the data as shown in the screen shot, please let me know how can I achieve this

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

0

if the data is a lot like more than a thousand use flatlist because it will only render a few data.

    <Flatlist
     data={data.personaldata}
     renderItem={({item})=>{
     return(
     <View style={{flexDirection:'row',justifyContent:'space-beetwen',paddingHorizontal:20}}>
         <Text>{item.name}</Text>
        <View>
       {item.time.map((time)=>{
        return (
           <Text>{time.start}-{time.end}</Text>
        )
       })}
       <View>
     </View>
     )
     }}
    />
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use Map function for your use. You can map over the data and get corresponding values and display as text. A basic implementation for same is as follows:

<View
      style={{
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: 'white',
      }}>
      {data.personaldata.map(item => {
        // uncomment below line to see what item is
        // console.log(item);
        return (
          <>
            <Text>{item.name}</Text>
            {item.time.map(item => {
              return (
                <Text>
                  {item.start} {item.end}
                </Text>
              );
            })}
          </>
        );
      })}
    </View>

Here I have applied map over data.personalData which gave me data for each user/entity and then again apply map over item.time which gives start and end time for each index.

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