Completed

Help with React Native / Ajuda com React Native

Published on the March 12, 2018 in IT & Programming

About this project

Open

I need to do a loop in a json file and set a image on each item.
Preciso fazer um loop em um arquivo json e configurar uma imagem para cada item.

{This.state.items.map((item) => (
  [[View style={{flex:1}}]]
    [[TouchableHighlight style={{flex:1}}
      onPress={() => this.props.navigation.navigate('Consulta')}]]
      [[Image
        style={{flex:1}}
        source={require({$item.imagem})}
      /]]
    [[/TouchableHighlight]]
  [[/View]]

I change < for [[ and > for ]]
  )
)}

I receive this error / Eu recebo o erro:

bundling failed: Error: calls to require expect exactly 1 string literal argument, but this was found: require("" + item.imagem).

My json file / Meu arquivo json

[{"id":"87","codigo":"00504.050.000.00.00","imagem":"imagem1.jpg"},{"id":"86","codigo":"02023.050.000.10.02","imagem":"imagem2.jpg"},{"id":"85","codigo":"00212.070.999.00.00","imagem":"imagem3.jpg"},{"id":"84","codigo":"01297.019.000.00.00","imagem":"imagem4.jpg"}]

Category IT & Programming
Subcategory Apps programming. Android, iOS and others
What is the scope of the project? Small change or bug
Is this a project or a position? I don’t know yet
I currently have Not applicable
Required availability As needed
Experience in this type of projects No (I haven’t managed this kind of project before)
Required platforms Android, Other

Delivery term: Not specified

Skills needed