我在SO和几个应用程序上遇到了几个问题,我遇到了以下样式配置: -
container: {
flex:1,
width: null,
},
Run Code Online (Sandbox Code Playgroud)
我想知道width:null这里的用途是什么.有人可以帮忙吗?
<Image source={require('./images/MacWallPaper.jpg')} style={styles.container}>
</Image>
Run Code Online (Sandbox Code Playgroud)
如果未指定width: null和height: null组件提取源图像的实际宽度和高度.
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(0, 0, 0, 0)',
}
Run Code Online (Sandbox Code Playgroud)
当您明确指定width: null并且height: null组件不会使用图像的实际宽度和高度时.
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(0, 0, 0, 0)',
// remove width and height to override fixed static size
width: null,
height: null,
}
Run Code Online (Sandbox Code Playgroud)
观看此视频
| 归档时间: |
|
| 查看次数: |
2104 次 |
| 最近记录: |