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

97
Vistas
React Native Checkbox List pass props

So I'm trying to pass props from an array to render on screen with the checkbox list. Instead, my function passes objects and not props. I was able to pass one prop but not the others. I was following an example that did a newsfeed but the articles were objects. (using snack.expo)

How can I pass props instead of objects?

code: array: let tasks = [ { title: 'My first completed task', checked: true, }, { title: 'My second task', checked: false, }, { title: 'My third task', checked: false, }, ];

function: renderCheckBox(){ let checkbox = [ ];

    for(let i = 0; i < tasks.length; i++){
      let t = tasks[i]
      checkbox.push( <Checkbox onToggleChange={t}/>);
      
    }
    return checkbox;
  }

View:

  {this.renderCheckBox()}

  

</SafeAreaView>

I can get the check boxes to show but not the tasks.

Any help is greatly appreciated.

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

0

You should learn about JSX. And how to render in combination with the map() function. Here is answer for you:

const tasks = [ { title: 'My first completed task', checked: true, }, { title: 'My second task', checked: false, }, { title: 'My third task', checked: false, }, ];
<SafeAreaView>
{tasks.map((item: any) => <Checkbox onToggleChange={t} title={item.title} checked={item.checked}/>}
</SafeAreaView>

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