阵营本地需要()网络与静态图像调整
问题描述:
为什么当我使用网络图像,阵营本地需要()网络与静态图像调整
<View style={{flex: 1, alignItems: 'stretch'}}>
<Image
style={{flex: 1}}
source={{uri: 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'}} />
</View>
但是当我使用要求()了静态图像:
<View style={{flex: 1, alignItems: 'stretch'}}>
<Image
style={{flex: 1}}
source={require('./googlelogo.png')} />
</View>
运行react-native 0.37.0。这段代码直接添加到了新鲜的react-native init
-ed项目中,没有任何第三方库或任何东西。
答
也许您的问题与this相同。
尝试图像的宽度设置为null
:
<Image
style={{flex: 1, width: null}}
source={require('./googlelogo.png')} />