App08FlexLayout.js 871 B

1234567891011121314151617181920212223242526
  1. import React from 'react';
  2. import { View } from 'react-native';
  3. class FlexDirectionBasics extends React.Component {
  4. render() {
  5. return (
  6. // Try with height: 300 instead of flex: 1
  7. <View style={{
  8. flex: 1,
  9. // row or column
  10. flexDirection: 'column',
  11. // flex-start, center, flex-end, space-around, space-between
  12. // space-evenly is also described, but throws invalid value error.
  13. justifyContent: 'space-around',
  14. // flex-start, center, flex-end, and stretch
  15. alignItems: 'center',
  16. }}>
  17. <View style={{ height: 50, width: 50, backgroundColor: 'powderblue' }} />
  18. <View style={{ height: 50, width: 50, backgroundColor: 'skyblue' }} />
  19. <View style={{ height: 50, width: 50, backgroundColor: 'steelblue' }} />
  20. </View>
  21. );
  22. }
  23. }
  24. export default FlexDirectionBasics;