diff --git a/example/src/pages/Layout.tsx b/example/src/pages/Layout.tsx index c04b5d3b..ad8eba6f 100644 --- a/example/src/pages/Layout.tsx +++ b/example/src/pages/Layout.tsx @@ -122,34 +122,20 @@ export const Layout = () => { }} > - {[...Array(3)].map((_el, i) => ( - - {`Block n.${i + 1}`} - - ))} - - - Different height - - + + + + + + + + + @@ -161,35 +147,19 @@ export const Layout = () => { }} > - {[...Array(3)].map((_el, i) => ( - - {`${i + 1}`} - - ))} - - - Growing block - - + + + + + + + + + @@ -214,3 +184,80 @@ export const Layout = () => { ); }; + +const VStackBlocks = () => { + const theme = useIOTheme(); + + return ( + <> + {[...Array(3)].map((_el, i) => ( + + {`Block n.${i + 1}`} + + ))} + + + Different height + + + + ); +}; + +const HStackBlocks = () => { + const theme = useIOTheme(); + + return ( + <> + {[...Array(3)].map((_el, i) => ( + + {`${ + i + 1 + }`} + + ))} + + + Growing block + + + + ); +}; diff --git a/src/components/stack/Stack.tsx b/src/components/stack/Stack.tsx index 8be521b3..7a426335 100644 --- a/src/components/stack/Stack.tsx +++ b/src/components/stack/Stack.tsx @@ -1,22 +1,24 @@ import React, { ReactNode } from "react"; -import { View } from "react-native"; +import { View, ViewStyle } from "react-native"; import { IOSpacer } from "../../core"; type Stack = { space?: IOSpacer; children: ReactNode; + alignItems?: ViewStyle["alignItems"]; }; /** Horizontal Stack component @param {IOSpacer} space */ -export const HStack = ({ space, children }: Stack) => ( +export const HStack = ({ space, children, alignItems }: Stack) => ( {children} @@ -28,12 +30,13 @@ Vertical Stack component @param {IOSpacer} space */ -export const VStack = ({ space, children }: Stack) => ( +export const VStack = ({ space, children, alignItems }: Stack) => ( {children} diff --git a/src/core/IOSpacing.ts b/src/core/IOSpacing.ts index a5457a3a..7c420632 100644 --- a/src/core/IOSpacing.ts +++ b/src/core/IOSpacing.ts @@ -23,9 +23,12 @@ export type IOSpacingScale = | 96; // Values used in the new `` component -export type IOSpacer = Extract; +export type IOSpacer = Extract< + IOSpacingScale, + 4 | 8 | 12 | 16 | 24 | 32 | 40 | 48 +>; export const IOSpacer: ReadonlyArray = [ - 4, 8, 16, 24, 32, 40, 48 + 4, 8, 12, 16, 24, 32, 40, 48 ] as const; // Margin values used in the new `` component