相互反应本机Flexbox堆叠视图

时间:2018-10-26 05:08:24

标签: reactjs flexbox native

如何将这三个盒子相互堆叠?

我尝试设置所有这些设置,但没有帮助 justifyContent: 'center', alignContent: 'center',alignSelf: 'center'

代码:

import React, { Component } from 'react';
import { AppRegistry, View } from 'react-native';

export default class FlexDirectionBasics extends Component {
  render() {
    return (
      // Try setting `flexDirection` to `column`.
      <View style={{  flex: 1, flexDirection: 'row' ,alignItems: 'center' ,
        justifyContent: 'center', alignContent: 'center',alignSelf: 'center'}}>
        <View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
      </View>
    );
  }
};

// skip this line if using Create React Native App
AppRegistry.registerComponent('AwesomeProject', () => FlexDirectionBasics);

1 个答案:

答案 0 :(得分:0)

使用 class Test { public static void main(String args[]) { int x; if(args.length>0) { x=10; } System.out.print(x); } } 属性将right与另一个属性重叠。

View

enter image description here 注意: 让我知道您是否想使用其他方式。