Render images sources from parsed array of objects in react native

后端 未结 1 1502
既然无缘
既然无缘 2021-01-28 05:31

I\'m building a react native application which suppose to use some \'meta-data\' objects as sources. I\'m parsing each object in array and returning a JSX layout for each

1条回答
  •  花落未央
    2021-01-28 06:03

    You can do something like this

      Details = [
            {
              type: "Party",
              image: require("../../../images/icons/photographer/Party.png")
            },
            {
              type: "Wedding",
              image: require("../../../images/icons/photographer/Wedding.png")
            },
            {
              type: "Architecture",
              image: require("../../../images/icons/photographer/Arhitecture.png")
            },
            {
              type: "Christening",
              image: require("../../../images/icons/photographer/Christening.png")
            }
      ];
    
      render() {
        let renderPhotoTypes = () => {
          let type = [];
    
          this.Details.map( ( item )=> {
            type.push(
              
                
                  
                    
                      
                    
                    {item.type}
                  
                
              
            );
          } );
    
          return type;
        };
    

    0 讨论(0)
提交回复
热议问题