mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
43 lines
96 KiB
HTML
43 lines
96 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
<meta name="generator" content="Docusaurus v2.0.0-alpha.70">
|
||
<link rel="alternate" type="application/rss+xml" href="/blog/rss.xml" title="React Native Blog RSS Feed">
|
||
<link rel="alternate" type="application/atom+xml" href="/blog/atom.xml" title="React Native Blog Atom Feed">
|
||
<link rel="preconnect" href="https://www.google-analytics.com">
|
||
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-41298772-2","auto"),ga("send","pageview")</script>
|
||
<script async src="https://www.google-analytics.com/analytics.js"></script>
|
||
<link rel="preconnect" href="https://www.google-analytics.com">
|
||
<link rel="preconnect" href="https://www.googletagmanager.com">
|
||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-41298772-2"></script>
|
||
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-41298772-2",{})</script>
|
||
<link rel="search" type="application/opensearchdescription+xml" title="React Native" href="/opensearch.xml">
|
||
<script src="https://cdn.jsdelivr.net/npm/focus-visible@5.2.0/dist/focus-visible.min.js" defer="defer"></script>
|
||
<script src="https://snack.expo.io/embed.js" defer="defer"></script><title data-react-helmet="true">Layout with Flexbox · React Native</title><meta data-react-helmet="true" name="twitter:image:alt" content="Image for React Native"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="current"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" name="twitter:card" content="summary"><meta data-react-helmet="true" name="twitter:image" content="https://reactnative.dev/img/logo-og.png"><meta data-react-helmet="true" property="og:title" content="Layout with Flexbox · React Native"><meta data-react-helmet="true" name="description" content="A component can specify the layout of its children using the Flexbox algorithm. Flexbox is designed to provide a consistent layout on different screen sizes."><meta data-react-helmet="true" property="og:description" content="A component can specify the layout of its children using the Flexbox algorithm. Flexbox is designed to provide a consistent layout on different screen sizes."><meta data-react-helmet="true" property="og:url" content="https://reactnative.dev/docs/next/flexbox"><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico"><link data-react-helmet="true" rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin="anonymous"><link data-react-helmet="true" rel="canonical" href="https://reactnative.dev/docs/next/flexbox"><link rel="stylesheet" href="/styles.9eb50f2e.css">
|
||
<link rel="stylesheet" href="/main.3de2b5ef.css">
|
||
<link rel="preload" href="/styles.1b71bc8a.js" as="script">
|
||
<link rel="preload" href="/runtime~main.c97aa552.js" as="script">
|
||
<link rel="preload" href="/main.253479d9.js" as="script">
|
||
<link rel="preload" href="/1.4dffec5b.js" as="script">
|
||
<link rel="preload" href="/2.8fcdf5b9.js" as="script">
|
||
<link rel="preload" href="/939.c1f14adb.js" as="script">
|
||
<link rel="preload" href="/935f2afb.63ef0aae.js" as="script">
|
||
<link rel="preload" href="/17896441.81f68a15.js" as="script">
|
||
<link rel="preload" href="/2164b80c.b13454d1.js" as="script">
|
||
</head>
|
||
<body>
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
|
||
<nav aria-label="Skip navigation links"><button type="button" tabindex="0" class="skipToContent_3aLp">Skip to main content</button></nav><nav class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><div aria-label="Navigation bar toggle" class="navbar__toggle" role="button" tabindex="0"><svg aria-label="Menu" width="30" height="30" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></div><a class="navbar__brand" href="/"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--light_VJaY navbar__logo"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--dark_1NF3 navbar__logo"><strong class="navbar__title">React Native</strong></a><div class="navbar__item dropdown dropdown--hoverable dropdown--left"><a class="navbar__item navbar__link" href="/docs/next/getting-started">Next</a><ul class="dropdown__menu"><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/docs/next/flexbox">Next</a></li><li><a class="dropdown__link" href="/docs/flexbox">0.63</a></li><li><a class="dropdown__link" href="/docs/0.62/flexbox">0.62</a></li><li><a class="dropdown__link" href="/docs/0.61/flexbox">0.61</a></li><li><a class="dropdown__link" href="/docs/0.60/flexbox">0.60</a></li><li><a class="dropdown__link" href="/versions">All versions</a></li></ul></div></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link navbar__link--active" href="/docs/next/getting-started">Docs</a><a class="navbar__item navbar__link" href="/docs/next/components-and-apis">Components</a><a class="navbar__item navbar__link" href="/docs/next/accessibilityinfo">API</a><a class="navbar__item navbar__link" href="/help">Community</a><a class="navbar__item navbar__link" href="/blog">Blog</a><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link navbar-github-link" aria-label="GitHub repository"></a><div class="react-toggle react-toggle--disabled displayOnlyInLargeViewport_Bh6k"><div class="react-toggle-track"><div class="react-toggle-track-check"><span class="toggle_1UDy">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_1UDy">🌞</span></div></div><div class="react-toggle-thumb"></div><input type="checkbox" disabled="" aria-label="Dark mode toggle" class="react-toggle-screenreader-only"></div><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span></button></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--light_VJaY navbar__logo"><img src="/img/header_logo.svg" alt="React Native" class="themedImage_phiS themedImage--dark_1NF3 navbar__logo"><strong class="navbar__title">React Native</strong></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link navbar__link--active" href="/docs/next/getting-started">Docs</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/next/components-and-apis">Components</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/next/accessibilityinfo">API</a></li><li class="menu__list-item"><a class="menu__link" href="/help">Community</a></li><li class="menu__list-item"><a class="menu__link" href="/blog">Blog</a></li><li class="menu__list-item"><a role="button" class="menu__link menu__link--sublist">Versions</a><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" href="/docs/next/flexbox">Next</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/flexbox">0.63</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.62/flexbox">0.62</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.61/flexbox">0.61</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/0.60/flexbox">0.60</a></li><li class="menu__list-item"><a class="menu__link" href="/versions">All versions</a></li></ul></li><li class="menu__list-item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="menu__link navbar-github-link" aria-label="GitHub repository"></a></li></ul></div></div></div></nav><div class="main-wrapper"><div class="docPage_1mVJ"><div class="docSidebarContainer_uPTz" role="complementary"><div class="sidebar_M-Lc"><div class="menu menu--responsive thin-scrollbar menu_tgpy"><button aria-label="Open Menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_1e05" width="24" height="24" viewBox="0 0 30 30" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">The Basics</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/getting-started">Introduction</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/intro-react-native-components">Core Components and Native Components</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/intro-react">React Fundamentals</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/handling-text-input">Handling Text Input</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/using-a-scrollview">Using a ScrollView</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/using-a-listview">Using List Views</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/troubleshooting">Troubleshooting</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/platform-specific-code">Platform Specific Code</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/more-resources">More Resources</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Environment setup</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/environment-setup">Setting up the development environment</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/integration-with-existing-apps">Integration with Existing Apps</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/integration-with-android-fragment">Integration with an Android Fragment</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/building-for-tv">Building For TV Devices</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/out-of-tree-platforms">Out-of-Tree Platforms</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Workflow</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/running-on-device">Running On Device</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/fast-refresh">Fast Refresh</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/debugging">Debugging</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/symbolication">Symbolicating a stack trace</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/testing-overview">Testing</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/libraries">Using Libraries</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/typescript">Using TypeScript</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/upgrading">Upgrading to new versions</a></li></ul></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">Design</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/next/style">Style</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/next/height-and-width">Height and Width</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/docs/next/flexbox">Layout with Flexbox</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/next/images">Images</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/next/colors">Color Reference</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Interaction</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/handling-touches">Handling Touches</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/navigation">Navigating Between Screens</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/animations">Animations</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/gesture-responder-system">Gesture Responder System</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Inclusion</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/accessibility">Accessibility</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Performance</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/performance">Performance Overview</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/optimizing-flatlist-configuration">Optimizing Flatlist Configuration</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/ram-bundles-inline-requires">RAM Bundles and Inline Requires</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/profiling">Profiling</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/profile-hermes">Profiling with Hermes</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">JavaScript Runtime</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/javascript-environment">JavaScript Environment</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/timers">Timers</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/hermes">Using Hermes</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Connectivity</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/network">Networking</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/security">Security</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Native Modules</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/native-modules-intro">Native Modules Intro</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/native-modules-android">Android Native Modules</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/native-modules-ios">iOS Native Modules</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/native-modules-setup">Native Modules NPM Package Setup</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Native Components</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/native-components-android">Android Native UI Components</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/native-components-ios">iOS Native UI Components</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/direct-manipulation">Direct Manipulation</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Guides (Android)</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/headless-js-android">Headless JS</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/signed-apk-android">Publishing to Google Play Store</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Guides (iOS)</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/linking-libraries-ios">Linking Libraries</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/running-on-simulator-ios">Running On Simulator</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/communication-ios">Communication between native and React Native</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/app-extensions">App Extensions</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/next/publishing-to-app-store">Publishing to Apple App Store</a></li></ul></li></ul></div></div></div><main class="docMainContainer_1zi2"><div class="container padding-vert--lg docItemWrapper_1hMI"><div class="row"><div class="col docItemCol_2AGf"><div class="alert alert--warning margin-bottom--md" role="alert"><div>This is unreleased documentation for React Native <strong>Next</strong> version.</div><div class="margin-top--md">For up-to-date documentation, see the <strong><a href="/docs/flexbox">latest version</a></strong> (0.63).</div></div><div class="docItemContainer_1tAC"><article><div><span class="badge badge--secondary">Version: Next</span></div><header><h1 class="docTitle_cWlf">Layout with Flexbox</h1></header><div class="markdown"><p>A component can specify the layout of its children using the Flexbox algorithm. Flexbox is designed to provide a consistent layout on different screen sizes.</p><p>You will normally use a combination of <code>flexDirection</code>, <code>alignItems</code>, and <code>justifyContent</code> to achieve the right layout.</p><blockquote><p>Flexbox works the same way in React Native as it does in CSS on the web, with a few exceptions. The defaults are different, with <code>flexDirection</code> defaulting to <code>column</code> instead of <code>row</code>, <code>alignContent</code> defaulting to <code>flex-start</code> instead of <code>stretch</code>, <code>flexShrink</code> defaulting to <code>0</code> instead of <code>1</code>, the <code>flex</code> parameter only supporting a single number.</p></blockquote><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="flex"></a>Flex<a class="hash-link" href="#flex" title="Direct link to heading">#</a></h2><p><a href="/docs/next/layout-props#flex"><code>flex</code></a> will define how your items are going to <strong>“fill”</strong> over the available space along your main axis. Space will be divided according to each element's flex property.</p><p>In the following example, the red, yellow, and green views are all children in the container view that has <code>flex: 1</code> set. The red view uses <code>flex: 1</code> , the yellow view uses <code>flex: 2</code>, and the green view uses <code>flex: 3</code> . <strong>1+2+3 = 6</strong>, which means that the red view will get <code>1/6</code> of the space, the yellow <code>2/6</code> of the space, and the green <code>3/6</code> of the space.</p><div class="snack-player" data-snack-name="Flex Example" data-snack-description="Example usage" data-snack-code="import%20React%20from%20%22react%22%3B%0Aimport%20%7B%20StyleSheet%2C%20Text%2C%20View%20%7D%20from%20%22react-native%22%3B%0A%0Aconst%20Flex%20%3D%20()%20%3D%3E%20%7B%0A%20%20return%20(%0A%20%20%20%20%3CView%20style%3D%7B%5Bstyles.container%2C%20%7B%0A%20%20%20%20%20%20%2F%2F%20Try%20setting%20%60flexDirection%60%20to%20%60%22row%22%60.%0A%20%20%20%20%20%20flexDirection%3A%20%22column%22%0A%20%20%20%20%7D%5D%7D%3E%0A%20%20%20%20%20%20%3CView%20style%3D%7B%7B%20flex%3A%201%2C%20backgroundColor%3A%20%22red%22%20%7D%7D%20%2F%3E%0A%20%20%20%20%20%20%3CView%20style%3D%7B%7B%20flex%3A%202%2C%20backgroundColor%3A%20%22darkorange%22%20%7D%7D%20%2F%3E%0A%20%20%20%20%20%20%3CView%20style%3D%7B%7B%20flex%3A%203%2C%20backgroundColor%3A%20%22green%22%20%7D%7D%20%2F%3E%0A%20%20%20%20%3C%2FView%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20padding%3A%2020%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20Flex%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="flex-direction"></a>Flex Direction<a class="hash-link" href="#flex-direction" title="Direct link to heading">#</a></h2><p><a href="/docs/next/layout-props#flexdirection"><code>flexDirection</code></a> controls the direction in which the children of a node are laid out. This is also referred to as the main axis. The cross axis is the axis perpendicular to the main axis, or the axis which the wrapping lines are laid out in.</p><ul><li><p><code>column</code> (<strong>default value</strong>) Align children from top to bottom. If wrapping is enabled, then the next line will start to the right of the first item on the top of the container.</p></li><li><p><code>row</code> Align children from left to right. If wrapping is enabled, then the next line will start under the first item on the left of the container.</p></li><li><p><code>column-reverse</code> Align children from bottom to top. If wrapping is enabled, then the next line will start to the right of the first item on the bottom of the container.</p></li><li><p><code>row-reverse</code> Align children from right to left. If wrapping is enabled, then the next line will start under the first item on the right of the container.</p></li></ul><p>You can learn more <a href="https://yogalayout.com/docs/flex-direction" target="_blank" rel="noopener noreferrer">here</a>.</p><div class="snack-player" data-snack-name="Flex Direction" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%20StyleSheet%2C%20Text%2C%20TouchableOpacity%2C%20View%20%7D%20from%20%22react-native%22%3B%0A%0Aconst%20FlexDirectionBasics%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5BflexDirection%2C%20setflexDirection%5D%20%3D%20useState(%22column%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22flexDirection%22%0A%20%20%20%20%20%20values%3D%7B%5B%22column%22%2C%20%22row%22%2C%20%22row-reverse%22%2C%20%22column-reverse%22%5D%7D%0A%20%20%20%20%20%20selectedValue%3D%7BflexDirection%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetflexDirection%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22powderblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22skyblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22steelblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%20style%3D%7B%5Bstyles.container%2C%20%7B%20%5Blabel%5D%3A%20selectedValue%20%7D%5D%7D%3E%0A%20%20%20%20%20%20%7Bchildren%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20FlexDirectionBasics%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="layout-direction"></a>Layout Direction<a class="hash-link" href="#layout-direction" title="Direct link to heading">#</a></h2><p>Layout direction specifies the direction in which children and text in a hierarchy should be laid out. Layout direction also affects what edge <code>start</code> and <code>end</code> refer to. By default, React Native lays out with LTR layout direction. In this mode <code>start</code> refers to left and <code>end</code> refers to right.</p><ul><li><p><code>LTR</code> (<strong>default value</strong>) Text and children are laid out from left to right. Margin and padding applied to the start of an element are applied on the left side.</p></li><li><p><code>RTL</code> Text and children are laid out from right to left. Margin and padding applied to the start of an element are applied on the right side.</p></li></ul><div class="snack-player" data-snack-name="Flex Direction" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%20View%2C%20TouchableOpacity%2C%20Text%2C%20StyleSheet%20%7D%20from%20%22react-native%22%3B%0A%0Aconst%20DirectionLayout%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5Bdirection%2C%20setDirection%5D%20%3D%20useState(%22ltr%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22direction%22%0A%20%20%20%20%20%20selectedValue%3D%7Bdirection%7D%0A%20%20%20%20%20%20values%3D%7B%5B%22ltr%22%2C%20%22rtl%22%5D%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetDirection%7D%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22powderblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22skyblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22steelblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%20style%3D%7B%5Bstyles.container%2C%20%7B%20%5Blabel%5D%3A%20selectedValue%20%7D%5D%7D%3E%0A%20%20%20%20%20%20%7Bchildren%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20DirectionLayout%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="justify-content"></a>Justify Content<a class="hash-link" href="#justify-content" title="Direct link to heading">#</a></h2><p><a href="/docs/next/layout-props#justifycontent"><code>justifyContent</code></a> describes how to align children within the main axis of their container. For example, you can use this property to center a child horizontally within a container with <code>flexDirection</code> set to <code>row</code> or vertically within a container with <code>flexDirection</code> set to <code>column</code>.</p><ul><li><p><code>flex-start</code>(<strong>default value</strong>) Align children of a container to the start of the container's main axis.</p></li><li><p><code>flex-end</code> Align children of a container to the end of the container's main axis.</p></li><li><p><code>center</code> Align children of a container in the center of the container's main axis.</p></li><li><p><code>space-between</code> Evenly space off children across the container's main axis, distributing the remaining space between the children.</p></li><li><p><code>space-around</code> Evenly space off children across the container's main axis, distributing the remaining space around the children. Compared to <code>space-between</code>, using <code>space-around</code> will result in space being distributed to the beginning of the first child and end of the last child.</p></li><li><p><code>space-evenly</code> Evenly distribute children within the alignment container along the main axis. The spacing between each pair of adjacent items, the main-start edge and the first item, and the main-end edge and the last item, are all exactly the same.</p></li></ul><p>You can learn more <a href="https://yogalayout.com/docs/justify-content" target="_blank" rel="noopener noreferrer">here</a>.</p><div class="snack-player" data-snack-name="Justify Content" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%20View%2C%20TouchableOpacity%2C%20Text%2C%20StyleSheet%20%7D%20from%20%22react-native%22%3B%0A%0Aconst%20JustifyContentBasics%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5BjustifyContent%2C%20setJustifyContent%5D%20%3D%20useState(%22flex-start%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22justifyContent%22%0A%20%20%20%20%20%20selectedValue%3D%7BjustifyContent%7D%0A%20%20%20%20%20%20values%3D%7B%5B%0A%20%20%20%20%20%20%20%20%22flex-start%22%2C%0A%20%20%20%20%20%20%20%20%22flex-end%22%2C%0A%20%20%20%20%20%20%20%20%22center%22%2C%0A%20%20%20%20%20%20%20%20%22space-between%22%2C%0A%20%20%20%20%20%20%20%20%22space-around%22%2C%0A%20%20%20%20%20%20%20%20%22space-evenly%22%2C%0A%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetJustifyContent%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22powderblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22skyblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22steelblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.button%2C%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%20style%3D%7B%5Bstyles.container%2C%20%7B%20%5Blabel%5D%3A%20selectedValue%20%7D%5D%7D%3E%0A%20%20%20%20%20%20%7Bchildren%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20JustifyContentBasics%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="align-items"></a>Align Items<a class="hash-link" href="#align-items" title="Direct link to heading">#</a></h2><p><a href="/docs/next/layout-props#alignitems"><code>alignItems</code></a> describes how to align children along the cross axis of their container. Align items is very similar to <code>justifyContent</code> but instead of applying to the main axis, <code>alignItems</code> applies to the cross axis.</p><ul><li><p><code>stretch</code> (<strong>default value</strong>) Stretch children of a container to match the <code>height</code> of the container's cross axis.</p></li><li><p><code>flex-start</code> Align children of a container to the start of the container's cross axis.</p></li><li><p><code>flex-end</code> Align children of a container to the end of the container's cross axis.</p></li><li><p><code>center</code> Align children of a container in the center of the container's cross axis.</p></li><li><p><code>baseline</code> Align children of a container along a common baseline. Individual children can be set to be the reference baseline for their parents.</p></li></ul><blockquote><p>For <code>stretch</code> to have an effect, children must not have a fixed dimension along the secondary axis. In the following example, setting <code>alignItems: stretch</code> does nothing until the <code>width: 50</code> is removed from the children.</p></blockquote><p>You can learn more <a href="https://yogalayout.com/docs/align-items" target="_blank" rel="noopener noreferrer">here</a>.</p><div class="snack-player" data-snack-name="Align Items" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%0A%20%20View%2C%0A%20%20TouchableOpacity%2C%0A%20%20Text%2C%0A%20%20StyleSheet%2C%0A%7D%20from%20%22react-native%22%3B%0A%0Aconst%20AlignItemsLayout%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5BalignItems%2C%20setAlignItems%5D%20%3D%20useState(%22stretch%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22alignItems%22%0A%20%20%20%20%20%20selectedValue%3D%7BalignItems%7D%0A%20%20%20%20%20%20values%3D%7B%5B%0A%20%20%20%20%20%20%20%20%22stretch%22%2C%0A%20%20%20%20%20%20%20%20%22flex-start%22%2C%0A%20%20%20%20%20%20%20%20%22flex-end%22%2C%0A%20%20%20%20%20%20%20%20%22center%22%2C%0A%20%20%20%20%20%20%20%20%22baseline%22%2C%0A%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetAlignItems%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22powderblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22skyblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22steelblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20width%3A%20%22auto%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20minWidth%3A%2050%2C%0A%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%0A%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20styles.container%2C%0A%20%20%20%20%20%20%20%20%7B%20%5Blabel%5D%3A%20selectedValue%20%7D%2C%0A%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%7Bchildren%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%20%20minHeight%3A%20200%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20AlignItemsLayout%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="align-self"></a>Align Self<a class="hash-link" href="#align-self" title="Direct link to heading">#</a></h2><p><a href="/docs/next/layout-props#alignself"><code>alignSelf</code></a> has the same options and effect as <code>alignItems</code> but instead of affecting the children within a container, you can apply this property to a single child to change its alignment within its parent. <code>alignSelf</code> overrides any option set by the parent with <code>alignItems</code>.</p><div class="snack-player" data-snack-name="Align Self" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%20View%2C%20TouchableOpacity%2C%20Text%2C%20StyleSheet%20%7D%20from%20%22react-native%22%3B%0A%0Aconst%20AlignSelfLayout%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5BalignSelf%2C%20setAlignSelf%5D%20%3D%20useState(%22stretch%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22alignSelf%22%0A%20%20%20%20%20%20selectedValue%3D%7BalignSelf%7D%0A%20%20%20%20%20%20values%3D%7B%5B%22stretch%22%2C%20%22flex-start%22%2C%20%22flex-end%22%2C%20%22center%22%2C%20%22baseline%22%5D%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetAlignSelf%7D%3E%0A%20%20%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20alignSelf%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20width%3A%20%22auto%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20minWidth%3A%2050%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22powderblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%7D%5D%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22skyblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22steelblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.container%7D%3E%0A%20%20%20%20%20%20%7Bchildren%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%20%20minHeight%3A%20200%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20AlignSelfLayout%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="align-content"></a>Align Content<a class="hash-link" href="#align-content" title="Direct link to heading">#</a></h2><p><a href="/docs/next/layout-props#aligncontent">alignContent</a> defines the distribution of lines along the cross-axis. This only has effect when items are wrapped to multiple lines using <code>flexWrap</code>.</p><ul><li><p><code>flex-start</code> (<strong>default value</strong>) Align wrapped lines to the start of the container's cross axis.</p></li><li><p><code>flex-end</code> Align wrapped lines to the end of the container's cross axis.</p></li><li><p><code>stretch</code> (<em>default value when using Yoga on the web</em>) Stretch wrapped lines to match the height of the container's cross axis.</p></li><li><p><code>center</code> Align wrapped lines in the center of the container's cross axis.</p></li><li><p><code>space-between</code> Evenly space wrapped lines across the container's cross axis, distributing the remaining space between the lines.</p></li><li><p><code>space-around</code> Evenly space wrapped lines across the container's cross axis, distributing the remaining space around the lines. Compared to <code>space-between</code>, using <code>space-around</code> will result in space being distributed to the beginning of the first line and the end of the last line.</p></li></ul><p>You can learn more <a href="https://yogalayout.com/docs/align-content" target="_blank" rel="noopener noreferrer">here</a>.</p><div class="snack-player" data-snack-name="Align Content" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%20View%2C%20TouchableOpacity%2C%20Text%2C%20StyleSheet%20%7D%20from%20%22react-native%22%3B%0A%0Aconst%20AlignContentLayout%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5BalignContent%2C%20setAlignContent%5D%20%3D%20useState(%22flex-start%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22alignContent%22%0A%20%20%20%20%20%20selectedValue%3D%7BalignContent%7D%0A%20%20%20%20%20%20values%3D%7B%5B%0A%20%20%20%20%20%20%20%20%22flex-start%22%2C%0A%20%20%20%20%20%20%20%20%22flex-end%22%2C%0A%20%20%20%20%20%20%20%20%22stretch%22%2C%0A%20%20%20%20%20%20%20%20%22center%22%2C%0A%20%20%20%20%20%20%20%20%22space-between%22%2C%0A%20%20%20%20%20%20%20%20%22space-around%22%2C%0A%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetAlignContent%7D%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22orangered%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22orange%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22mediumseagreen%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22deepskyblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22mediumturquoise%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22mediumslateblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22purple%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%0A%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20styles.container%2C%0A%20%20%20%20%20%20%20%20%7B%20%5Blabel%5D%3A%20selectedValue%20%7D%2C%0A%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%7Bchildren%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%20%20maxHeight%3A%20400%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2080%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20AlignContentLayout%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="flex-wrap"></a>Flex Wrap<a class="hash-link" href="#flex-wrap" title="Direct link to heading">#</a></h2><p>The <a href="/docs/next/layout-props#flexwrap"><code>flexWrap</code></a> property is set on containers and it controls what happens when children overflow the size of the container along the main axis. By default, children are forced into a single line (which can shrink elements). If wrapping is allowed, items are wrapped into multiple lines along the main axis if needed.</p><p>When wrapping lines, <code>alignContent</code> can be used to specify how the lines are placed in the container. Learn more <a href="https://yogalayout.com/docs/flex-wrap" target="_blank" rel="noopener noreferrer">here</a>.</p><div class="snack-player" data-snack-name="Flex Wrap" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%20View%2C%20TouchableOpacity%2C%20Text%2C%20StyleSheet%20%7D%20from%20%22react-native%22%3B%0A%0Aconst%20FlexWrapLayout%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5BflexWrap%2C%20setFlexWrap%5D%20%3D%20useState(%22wrap%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22flexWrap%22%0A%20%20%20%20%20%20selectedValue%3D%7BflexWrap%7D%0A%20%20%20%20%20%20values%3D%7B%5B%22wrap%22%2C%20%22no-wrap%22%5D%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetFlexWrap%7D%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22orangered%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22orange%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22mediumseagreen%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22deepskyblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22mediumturquoise%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22mediumslateblue%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5Bstyles.box%2C%20%7B%20backgroundColor%3A%20%22purple%22%20%7D%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%0A%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20styles.container%2C%0A%20%20%20%20%20%20%20%20%7B%20%5Blabel%5D%3A%20selectedValue%20%7D%2C%0A%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%7Bchildren%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%20%20maxHeight%3A%20400%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2080%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20FlexWrapLayout%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="flex-basis-grow-and-shrink"></a>Flex Basis, Grow, and Shrink<a class="hash-link" href="#flex-basis-grow-and-shrink" title="Direct link to heading">#</a></h2><ul><li><p><a href="/docs/next/layout-props#flexbasis"><code>flexBasis</code></a> is an axis-independent way of providing the default size of an item along the main axis. Setting the <code>flexBasis</code> of a child is similar to setting the <code>width</code> of that child if its parent is a container with <code>flexDirection: row</code> or setting the <code>height</code> of a child if its parent is a container with <code>flexDirection: column</code>. The <code>flexBasis</code> of an item is the default size of that item, the size of the item before any <code>flexGrow</code> and <code>flexShrink</code> calculations are performed.</p></li><li><p><a href="/docs/next/layout-props#flexgrow"><code>flexGrow</code></a> describes how any space within a container should be distributed among its children along the main axis. After laying out its children, a container will distribute any remaining space according to the flex grow values specified by its children.</p><p><code>flexGrow</code> accepts any floating point value >= 0, with 0 being the default value. A container will distribute any remaining space among its children weighted by the children’s <code>flexGrow</code> values.</p></li><li><p><a href="/docs/next/layout-props#flexshrink"><code>flexShrink</code></a> describes how to shrink children along the main axis in the case in which the total size of the children overflows the size of the container on the main axis. <code>flexShrink</code> is very similar to <code>flexGrow</code> and can be thought of in the same way if any overflowing size is considered to be negative remaining space. These two properties also work well together by allowing children to grow and shrink as needed.</p><p><code>flexShrink</code> accepts any floating point value >= 0, with 0 being the default value (on the web, the default is 1). A container will shrink its children weighted by the children’s <code>flexShrink</code> values.</p></li></ul><p>You can learn more <a href="https://yogalayout.com/docs/flex" target="_blank" rel="noopener noreferrer">here</a>.</p><div class="snack-player" data-snack-name="Flex Basis, Grow, and Shrink" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%0A%20%20View%2C%0A%20%20Text%2C%0A%20%20TextInput%2C%0A%20%20StyleSheet%2C%0A%7D%20from%20%22react-native%22%3B%0A%0Aconst%20App%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5Bpowderblue%2C%20setPowderblue%5D%20%3D%20useState(%7B%0A%20%20%20%20flexGrow%3A%200%2C%0A%20%20%20%20flexShrink%3A%201%2C%0A%20%20%20%20flexBasis%3A%20%22auto%22%2C%0A%20%20%7D)%3B%0A%20%20const%20%5Bskyblue%2C%20setSkyblue%5D%20%3D%20useState(%7B%0A%20%20%20%20flexGrow%3A%201%2C%0A%20%20%20%20flexShrink%3A%200%2C%0A%20%20%20%20flexBasis%3A%20100%2C%0A%20%20%7D)%3B%0A%20%20const%20%5Bsteelblue%2C%20setSteelblue%5D%20%3D%20useState(%7B%0A%20%20%20%20flexGrow%3A%200%2C%0A%20%20%20%20flexShrink%3A%201%2C%0A%20%20%20%20flexBasis%3A%20200%2C%0A%20%20%7D)%3B%0A%20%20return%20(%0A%20%20%20%20%3CView%20style%3D%7Bstyles.container%7D%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20styles.container%2C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20alignContent%3A%20%22space-between%22%2C%0A%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%3CBoxInfo%0A%20%20%20%20%20%20%20%20%20%20color%3D%22powderblue%22%0A%20%20%20%20%20%20%20%20%20%20%7B...powderblue%7D%0A%20%20%20%20%20%20%20%20%20%20setStyle%3D%7BsetPowderblue%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%20%20%3CBoxInfo%0A%20%20%20%20%20%20%20%20%20%20color%3D%22skyblue%22%0A%20%20%20%20%20%20%20%20%20%20%7B...skyblue%7D%0A%20%20%20%20%20%20%20%20%20%20setStyle%3D%7BsetSkyblue%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%20%20%3CBoxInfo%0A%20%20%20%20%20%20%20%20%20%20color%3D%22steelblue%22%0A%20%20%20%20%20%20%20%20%20%20%7B...steelblue%7D%0A%20%20%20%20%20%20%20%20%20%20setStyle%3D%7BsetSteelblue%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%20%20%3CView%20style%3D%7Bstyles.previewContainer%7D%3E%0A%20%20%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexBasis%3A%20powderblue.flexBasis%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexGrow%3A%20powderblue.flexGrow%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexShrink%3A%20powderblue.flexShrink%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22powderblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexBasis%3A%20skyblue.flexBasis%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexGrow%3A%20skyblue.flexGrow%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexShrink%3A%20skyblue.flexShrink%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22skyblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexBasis%3A%20steelblue.flexBasis%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexGrow%3A%20steelblue.flexGrow%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20flexShrink%3A%20steelblue.flexShrink%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22steelblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3C%2FView%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20BoxInfo%20%3D%20(%7B%0A%20%20color%2C%0A%20%20flexBasis%2C%0A%20%20flexShrink%2C%0A%20%20setStyle%2C%0A%20%20flexGrow%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%5Bstyles.row%2C%20%7B%20flexDirection%3A%20%22column%22%20%7D%5D%7D%3E%0A%20%20%20%20%3CView%0A%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20styles.boxLabel%2C%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20color%2C%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20style%3D%7B%7B%0A%20%20%20%20%20%20%20%20%20%20color%3A%20%22%23fff%22%2C%0A%20%20%20%20%20%20%20%20%20%20fontWeight%3A%20500%2C%0A%20%20%20%20%20%20%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20%20%20%20%20%7D%7D%0A%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20Box%0A%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3EflexBasis%3C%2FText%3E%0A%20%20%20%20%3CTextInput%0A%20%20%20%20%20%20value%3D%7BflexBasis%7D%0A%20%20%20%20%20%20style%3D%7Bstyles.input%7D%0A%20%20%20%20%20%20onChangeText%3D%7B(fB)%20%3D%3E%0A%20%20%20%20%20%20%20%20setStyle((value)%20%3D%3E%20(%7B%0A%20%20%20%20%20%20%20%20%20%20...value%2C%0A%20%20%20%20%20%20%20%20%20%20flexBasis%3A%20isNaN(parseInt(fB))%0A%20%20%20%20%20%20%20%20%20%20%20%20%3F%20%22auto%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%3A%20parseInt(fB)%2C%0A%20%20%20%20%20%20%20%20%7D))%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%2F%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3EflexShrink%3C%2FText%3E%0A%20%20%20%20%3CTextInput%0A%20%20%20%20%20%20value%3D%7BflexShrink%7D%0A%20%20%20%20%20%20style%3D%7Bstyles.input%7D%0A%20%20%20%20%20%20onChangeText%3D%7B(fS)%20%3D%3E%0A%20%20%20%20%20%20%20%20setStyle((value)%20%3D%3E%20(%7B%0A%20%20%20%20%20%20%20%20%20%20...value%2C%0A%20%20%20%20%20%20%20%20%20%20flexShrink%3A%20isNaN(parseInt(fS))%0A%20%20%20%20%20%20%20%20%20%20%20%20%3F%20%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%3A%20parseInt(fS)%2C%0A%20%20%20%20%20%20%20%20%7D))%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%2F%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3EflexGrow%3C%2FText%3E%0A%20%20%20%20%3CTextInput%0A%20%20%20%20%20%20value%3D%7BflexGrow%7D%0A%20%20%20%20%20%20style%3D%7Bstyles.input%7D%0A%20%20%20%20%20%20onChangeText%3D%7B(fG)%20%3D%3E%0A%20%20%20%20%20%20%20%20setStyle((value)%20%3D%3E%20(%7B%0A%20%20%20%20%20%20%20%20%20%20...value%2C%0A%20%20%20%20%20%20%20%20%20%20flexGrow%3A%20isNaN(parseInt(fG))%0A%20%20%20%20%20%20%20%20%20%20%20%20%3F%20%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%3A%20parseInt(fG)%2C%0A%20%20%20%20%20%20%20%20%7D))%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%2F%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20paddingHorizontal%3A%2010%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%20%20width%3A%2050%2C%0A%20%20%7D%2C%0A%20%20boxLabel%3A%20%7B%0A%20%20%20%20minWidth%3A%2080%2C%0A%20%20%20%20padding%3A%208%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20marginTop%3A%206%2C%0A%20%20%20%20fontSize%3A%2016%2C%0A%20%20%20%20fontWeight%3A%20%22100%22%2C%0A%20%20%7D%2C%0A%20%20previewContainer%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%20%20alignItems%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%7D%2C%0A%20%20input%3A%20%7B%0A%20%20%20%20borderBottomWidth%3A%201%2C%0A%20%20%20%20paddingVertical%3A%203%2C%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20App%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="width-and-height"></a>Width and Height<a class="hash-link" href="#width-and-height" title="Direct link to heading">#</a></h2><p>The <code>width</code> property specifies the width of an element's content area. Similarly, the <code>height</code> property specifies the height of an element's content area.</p><p>Both <code>width</code> and <code>height</code> can take the following values:</p><ul><li><p><code>auto</code> (<strong>default value</strong>) React Native calculates the width/height for the element based on its content, whether that is other children, text, or an image.</p></li><li><p><code>pixels</code> Defines the width/height in absolute pixels. Depending on other styles set on the component, this may or may not be the final dimension of the node.</p></li><li><p><code>percentage</code> Defines the width or height in percentage of its parent's width or height, respectively.</p></li></ul><div class="snack-player" data-snack-name="Width and Height" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%0A%20%20View%2C%0A%20%20SafeAreaView%2C%0A%20%20TouchableOpacity%2C%0A%20%20Text%2C%0A%20%20StyleSheet%2C%0A%7D%20from%20%22react-native%22%3B%0A%0Aconst%20WidthHeightBasics%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5BwidthType%2C%20setWidthType%5D%20%3D%20useState(%22auto%22)%3B%0A%20%20const%20%5BheightType%2C%20setHeightType%5D%20%3D%20useState(%22auto%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20widthType%3D%7BwidthType%7D%0A%20%20%20%20%20%20heightType%3D%7BheightType%7D%0A%20%20%20%20%20%20widthValues%3D%7B%5B%22auto%22%2C%20300%2C%20%2280%25%22%5D%7D%0A%20%20%20%20%20%20heightValues%3D%7B%5B%22auto%22%2C%20200%2C%20%2260%25%22%5D%7D%0A%20%20%20%20%20%20setWidthType%3D%7BsetWidthType%7D%0A%20%20%20%20%20%20setHeightType%3D%7BsetHeightType%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%7B%0A%20%20%20%20%20%20%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20height%3A%20heightType%2C%0A%20%20%20%20%20%20%20%20%20%20width%3A%20widthType%2C%0A%20%20%20%20%20%20%20%20%20%20padding%3A%2015%2C%0A%20%20%20%20%20%20%20%20%7D%7D%0A%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20backgroundColor%3A%20%22powderblue%22%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20backgroundColor%3A%20%22skyblue%22%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20backgroundColor%3A%20%22steelblue%22%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20children%2C%0A%20%20widthType%2C%0A%20%20heightType%2C%0A%20%20widthValues%2C%0A%20%20heightValues%2C%0A%20%20setWidthType%2C%0A%20%20setHeightType%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20flex%3A%201%2C%20padding%3A%2010%20%7D%7D%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3Ewidth%20%3C%2FText%3E%0A%20%20%20%20%20%20%7BwidthValues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setWidthType(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20widthType%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20widthType%20%3D%3D%3D%20value%20%26%26%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3Eheight%20%3C%2FText%3E%0A%20%20%20%20%20%20%7BheightValues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setHeightType(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20heightType%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20heightType%20%3D%3D%3D%20value%20%26%26%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%7Bchildren%7D%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20padding%3A%208%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginRight%3A%2010%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20shadowOpacity%3A%200%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20WidthHeightBasics%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="absolute--relative-layout"></a>Absolute & Relative Layout<a class="hash-link" href="#absolute--relative-layout" title="Direct link to heading">#</a></h2><p>The <code>position</code> type of an element defines how it is positioned within its parent.</p><ul><li><p><code>relative</code> (<strong>default value</strong>) By default, an element is positioned relatively. This means an element is positioned according to the normal flow of the layout, and then offset relative to that position based on the values of <code>top</code>, <code>right</code>, <code>bottom</code>, and <code>left</code>. The offset does not affect the position of any sibling or parent elements.</p></li><li><p><code>absolute</code> When positioned absolutely, an element doesn't take part in the normal layout flow. It is instead laid out independent of its siblings. The position is determined based on the <code>top</code>, <code>right</code>, <code>bottom</code>, and <code>left</code> values.</p></li></ul><div class="snack-player" data-snack-name="Absolute & Relative Layout" data-snack-description="Example usage" data-snack-code="import%20React%2C%20%7B%20useState%20%7D%20from%20%22react%22%3B%0Aimport%20%7B%0A%20%20View%2C%0A%20%20SafeAreaView%2C%0A%20%20TouchableOpacity%2C%0A%20%20Text%2C%0A%20%20StyleSheet%2C%0A%7D%20from%20%22react-native%22%3B%0A%0Aconst%20PositionLayout%20%3D%20()%20%3D%3E%20%7B%0A%20%20const%20%5Bposition%2C%20setPosition%5D%20%3D%20useState(%22relative%22)%3B%0A%0A%20%20return%20(%0A%20%20%20%20%3CPreviewLayout%0A%20%20%20%20%20%20label%3D%22position%22%0A%20%20%20%20%20%20selectedValue%3D%7Bposition%7D%0A%20%20%20%20%20%20values%3D%7B%5B%22relative%22%2C%20%22absolute%22%5D%7D%0A%20%20%20%20%20%20setSelectedValue%3D%7BsetPosition%7D%0A%20%20%20%20%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20top%3A%2025%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20left%3A%2025%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20position%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22powderblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20top%3A%2050%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20left%3A%2050%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20position%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22skyblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%20%20%3CView%0A%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20styles.box%2C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20top%3A%2075%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20left%3A%2075%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20position%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20backgroundColor%3A%20%22steelblue%22%2C%0A%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%2F%3E%0A%20%20%20%20%3C%2FPreviewLayout%3E%0A%20%20)%3B%0A%7D%3B%0A%0Aconst%20PreviewLayout%20%3D%20(%7B%0A%20%20label%2C%0A%20%20children%2C%0A%20%20values%2C%0A%20%20selectedValue%2C%0A%20%20setSelectedValue%2C%0A%7D)%20%3D%3E%20(%0A%20%20%3CView%20style%3D%7B%7B%20padding%3A%2010%2C%20flex%3A%201%20%7D%7D%3E%0A%20%20%20%20%3CText%20style%3D%7Bstyles.label%7D%3E%7Blabel%7D%3C%2FText%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.row%7D%3E%0A%20%20%20%20%20%20%7Bvalues.map((value)%20%3D%3E%20(%0A%20%20%20%20%20%20%20%20%3CTouchableOpacity%0A%20%20%20%20%20%20%20%20%20%20key%3D%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20onPress%3D%7B()%20%3D%3E%20setSelectedValue(value)%7D%0A%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20styles.button%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%20styles.selected%2C%0A%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%3CText%0A%20%20%20%20%20%20%20%20%20%20%20%20style%3D%7B%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.buttonLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20selectedValue%20%3D%3D%3D%20value%20%26%26%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20styles.selectedLabel%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%7D%0A%20%20%20%20%20%20%20%20%20%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Bvalue%7D%0A%20%20%20%20%20%20%20%20%20%20%3C%2FText%3E%0A%20%20%20%20%20%20%20%20%3C%2FTouchableOpacity%3E%0A%20%20%20%20%20%20))%7D%0A%20%20%20%20%3C%2FView%3E%0A%20%20%20%20%3CView%20style%3D%7Bstyles.container%7D%3E%7Bchildren%7D%3C%2FView%3E%0A%20%20%3C%2FView%3E%0A)%3B%0A%0Aconst%20styles%20%3D%20StyleSheet.create(%7B%0A%20%20container%3A%20%7B%0A%20%20%20%20flex%3A%201%2C%0A%20%20%20%20marginTop%3A%208%2C%0A%20%20%20%20backgroundColor%3A%20%22aliceblue%22%2C%0A%20%20%20%20minHeight%3A%20200%2C%0A%20%20%7D%2C%0A%20%20box%3A%20%7B%0A%20%20%20%20width%3A%2050%2C%0A%20%20%20%20height%3A%2050%2C%0A%20%20%7D%2C%0A%20%20row%3A%20%7B%0A%20%20%20%20flexDirection%3A%20%22row%22%2C%0A%20%20%20%20flexWrap%3A%20%22wrap%22%2C%0A%20%20%7D%2C%0A%20%20button%3A%20%7B%0A%20%20%20%20paddingHorizontal%3A%208%2C%0A%20%20%20%20paddingVertical%3A%206%2C%0A%20%20%20%20borderRadius%3A%204%2C%0A%20%20%20%20backgroundColor%3A%20%22oldlace%22%2C%0A%20%20%20%20alignSelf%3A%20%22flex-start%22%2C%0A%20%20%20%20marginHorizontal%3A%20%221%25%22%2C%0A%20%20%20%20marginBottom%3A%206%2C%0A%20%20%20%20minWidth%3A%20%2248%25%22%2C%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%7D%2C%0A%20%20selected%3A%20%7B%0A%20%20%20%20backgroundColor%3A%20%22coral%22%2C%0A%20%20%20%20borderWidth%3A%200%2C%0A%20%20%7D%2C%0A%20%20buttonLabel%3A%20%7B%0A%20%20%20%20fontSize%3A%2012%2C%0A%20%20%20%20fontWeight%3A%20%22500%22%2C%0A%20%20%20%20color%3A%20%22coral%22%2C%0A%20%20%7D%2C%0A%20%20selectedLabel%3A%20%7B%0A%20%20%20%20color%3A%20%22white%22%2C%0A%20%20%7D%2C%0A%20%20label%3A%20%7B%0A%20%20%20%20textAlign%3A%20%22center%22%2C%0A%20%20%20%20marginBottom%3A%2010%2C%0A%20%20%20%20fontSize%3A%2024%2C%0A%20%20%7D%2C%0A%7D)%3B%0A%0Aexport%20default%20PositionLayout%3B" data-snack-dependencies="" data-snack-platform="web" data-snack-supported-platforms="ios,android,web" data-snack-theme="light" data-snack-preview="true" data-snack-loading="lazy"></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_E4oP" id="going-deeper"></a>Going Deeper<a class="hash-link" href="#going-deeper" title="Direct link to heading">#</a></h2><p>Check out the interactive <a href="https://yogalayout.com/playground" target="_blank" rel="noopener noreferrer">yoga playground</a> that you can use to get a better understanding of flexbox.</p><p>We've covered the basics, but there are many other styles you may need for layouts. The full list of props that control layout is documented <a href="/docs/next/layout-props">here</a>.</p><p>Additionally, you can see some examples from <a href="https://medium.com/wix-engineering/the-full-react-native-layout-cheat-sheet-a4147802405c" target="_blank" rel="noopener noreferrer">Wix Engineers</a>.</p></div></article><div class="docMetadata margin-vert--xl"><div class="row"><div class="col"><a href="https://github.com/facebook/react-native-website/blob/master/website/../docs/flexbox.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="1.2em" width="1.2em" preserveAspectRatio="xMidYMid meet" role="img" viewBox="0 0 40 40" class="iconEdit_2Hwv"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col text--right"><em><small class="docMetadata-updated">Last updated on <time datetime="2021-02-17T13:29:44.000Z" class="docLastUpdatedAt_1gIo">2/17/2021</time></small></em></div></div></div><div class="margin-vert--lg"><nav class="pagination-nav" aria-label="Blog list page navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/next/height-and-width"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« Height and Width</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/next/images"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Images »</div></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_1zTD thin-scrollbar"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#flex" class="table-of-contents__link">Flex</a></li><li><a href="#flex-direction" class="table-of-contents__link">Flex Direction</a></li><li><a href="#layout-direction" class="table-of-contents__link">Layout Direction</a></li><li><a href="#justify-content" class="table-of-contents__link">Justify Content</a></li><li><a href="#align-items" class="table-of-contents__link">Align Items</a></li><li><a href="#align-self" class="table-of-contents__link">Align Self</a></li><li><a href="#align-content" class="table-of-contents__link">Align Content</a></li><li><a href="#flex-wrap" class="table-of-contents__link">Flex Wrap</a></li><li><a href="#flex-basis-grow-and-shrink" class="table-of-contents__link">Flex Basis, Grow, and Shrink</a></li><li><a href="#width-and-height" class="table-of-contents__link">Width and Height</a></li><li><a href="#absolute--relative-layout" class="table-of-contents__link">Absolute & Relative Layout</a></li><li><a href="#going-deeper" class="table-of-contents__link">Going Deeper</a></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><h4 class="footer__title">Docs</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/getting-started">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/tutorial">Tutorial</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/components-and-apis">Components and APIs</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/more-resources">More Resources</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Community</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/help">The React Native Community</a></li><li class="footer__item"><a class="footer__link-item" href="/showcase">Who's using React Native?</a></li><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">Ask Questions on Stack Overflow</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md" target="_blank" rel="noopener noreferrer" class="footer__link-item">Contributor Guide</a></li><li class="footer__item"><a href="https://dev.to/t/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">DEV Community</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Find us</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/blog">Blog</a></li><li class="footer__item"><a href="https://twitter.com/reactnative" target="_blank" rel="noopener noreferrer" class="footer__link-item">Twitter</a></li><li class="footer__item"><a href="https://github.com/facebook/react-native" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">More</h4><ul class="footer__items"><li class="footer__item"><a href="https://reactjs.org/" target="_blank" rel="noopener noreferrer" class="footer__link-item">React</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/privacy" target="_blank" rel="noopener noreferrer" class="footer__link-item">Privacy Policy</a></li><li class="footer__item"><a href="https://opensource.facebook.com/legal/terms" target="_blank" rel="noopener noreferrer" class="footer__link-item">Terms of Service</a></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><a href="https://opensource.facebook.com" target="_blank" rel="noopener noreferrer" class="footerLogoLink_3cAK"><img class="footer__logo" alt="Facebook Open Source Logo" src="/img/oss_logo.png"></a></div><div class="footer__copyright">Copyright © 2021 Facebook, Inc.</div></div></div></footer></div>
|
||
<script src="/styles.1b71bc8a.js"></script>
|
||
<script src="/runtime~main.c97aa552.js"></script>
|
||
<script src="/main.253479d9.js"></script>
|
||
<script src="/1.4dffec5b.js"></script>
|
||
<script src="/2.8fcdf5b9.js"></script>
|
||
<script src="/939.c1f14adb.js"></script>
|
||
<script src="/935f2afb.63ef0aae.js"></script>
|
||
<script src="/17896441.81f68a15.js"></script>
|
||
<script src="/2164b80c.b13454d1.js"></script>
|
||
</body>
|
||
</html> |