React Native - Image Require Module using Dynamic Names

前端 未结 14 908
夕颜
夕颜 2020-11-22 11:29

I\'m currently building a test app using React Native. The Image module, thus far has been working fine.

For example, if I had an image named avatar, th

相关标签:
14条回答
  • 2020-11-22 12:15
     <StyledInput text="NAME" imgUri={require('../assets/userIcon.png')} ></StyledInput> 
    
    <Image
                source={this.props.imgUri}
                style={{
                  height: 30,
                  width: 30,
                  resizeMode: 'contain',
                }}
              />   
    

    in my case i tried so much but finally it work StyledInput component name image inside the StyledInput if you still not understand let me know

    0 讨论(0)
  • 2020-11-22 12:17

    I know this is old but I'm going to add this here as I've found this question, whilst searching for a solution. The docs allow for a uri: 'Network Image'

    https://facebook.github.io/react-native/docs/images#network-images

    For me I got images working dynamically with this

    <Image source={{uri: image}} />
    
    0 讨论(0)
提交回复
热议问题