Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

105
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda