/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ 'use strict'; import type {RNTesterModuleExample} from '../../types/RNTesterTypes'; import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; import RNTesterBlock from '../../components/RNTesterBlock'; import RNTesterPage from '../../components/RNTesterPage'; import RNTesterText from '../../components/RNTesterText'; import React from 'react'; import {StyleSheet, View} from 'react-native'; type CicleProps = $ReadOnly<{ backgroundColor?: string, size?: number, }>; function Circle({ backgroundColor = '#527fe4', size = 20, }: CicleProps): React.Node { return ( ); } type CircleBlockProps = $ReadOnly<{ children: React.Node, style: ViewStyleProp, }>; function CircleBlock({children, style}: CircleBlockProps): React.Node { const circleStyle = { flexDirection: 'row', backgroundColor: '#f6f7f8', borderWidth: 0.5, borderColor: '#d6d7da', marginBottom: 2, }; /* $FlowFixMe[incompatible-type] Natural Inference rollout. See * https://fburl.com/workplace/6291gfvu */ return {children}; } function LayoutExample(): React.Node { const fiveColoredCircles = [ , , , , , ]; return ( row {fiveColoredCircles} row-reverse {fiveColoredCircles} column {fiveColoredCircles} column-reverse {fiveColoredCircles} {'top: 15, left: 160'} flex-start {fiveColoredCircles} center {fiveColoredCircles} flex-end {fiveColoredCircles} space-between {fiveColoredCircles} space-around {fiveColoredCircles} flex-start center flex-end {'oooooooooooooooo'.split('').map((char, i) => ( ))} ); } const styles = StyleSheet.create({ overlay: { backgroundColor: '#aaccff', borderRadius: 10, borderWidth: 0.5, opacity: 0.5, padding: 5, }, }); exports.title = 'Layout - Flexbox'; exports.category = 'UI'; exports.description = 'Examples of using the flexbox API to layout views.'; exports.displayName = 'LayoutExample'; exports.examples = [ { title: 'Simple layout using flexbox', render(): React.MixedElement { return ; }, }, ] as Array;