Sto*_*ace 4 javascript styles stylesheet react-native
父级component具有以下样式
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#FFF',
alignItems: 'center',
justifyContent: 'center',
},
});
Run Code Online (Sandbox Code Playgroud)
我component在这个组件中放置另一个.我希望它在右上角.
当然,我会在这个孩子中使用以下风格component:
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
top: 20,
right: 5,
},
});
Run Code Online (Sandbox Code Playgroud)
然而,它把它在顶部左侧角落.我可以把它移动到右上角的唯一方法是更换right: 5用left: 500.但那不是那种方式......
请检查下面的子组件样式表:
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
alignSelf: 'flex-end',
marginTop: -5,
position: 'absolute', // add if dont work with above
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8216 次 |
| 最近记录: |