Answers for "react native image file path variable"

1

react native image file path variable

// Need to have all variable files already set with require 

const images = {
    profile: {
        profile: require('./profile/profile.png'),
        comments: require('./profile/comments.png'),
    },
    image1: require('./image1.jpg'),
    image2: require('./image2.jpg'),
};

return (
	<View>
  {
  	props.profile ? <Image source={images.profile.profile} /> : <Image source={images.profile.comments} />
  }
  </View>
)
Posted by: Guest on December-15-2020

Code answers related to "react native image file path variable"

Code answers related to "Javascript"

Browse Popular Code Answers by Language