【发布时间】:2015-06-15 00:34:20
【问题描述】:
我想在屏幕底部放置一个占据所有宽度的白条。为此,我考虑过将absolute 定位与继承的flexbox 参数一起使用。
使用以下代码,它会呈现类似this 的内容。
这是我的代码:
var NavigationBar = React.createClass({
render: function() {
return(
<View style={navigationBarStyles.navigationBar}>
//Icon 1, Icon 2...
</View>
);
}
});
var Main = React.createClass({
render: function() {
return(
<View style={mainStyles.container}>
<NavigationBar />
</View>
);
}
});
var mainStyles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#456783',
}
});
var navigationBarStyles = StyleSheet.create({
navigationBar: {
backgroundColor: '#FFFFFF',
height: 30,
position: 'absolute',
flexDirection: 'row',
bottom: 0,
justifyContent: 'space-between'
},
});
我是 CSS 样式的新手,并非所有属性都在 React-Native 中可用。因此,感谢您提供任何帮助,谢谢:)
【问题讨论】:
标签: javascript css react-native