diff --git a/example/src/components/SpacerViewerBox.tsx b/example/src/components/SpacerViewerBox.tsx
index 31817b0c..d8695fc0 100644
--- a/example/src/components/SpacerViewerBox.tsx
+++ b/example/src/components/SpacerViewerBox.tsx
@@ -2,7 +2,6 @@ import {
HSpacer,
IOColors,
IOSpacer,
- SpacerOrientation,
VSpacer,
useIOTheme
} from "@pagopa/io-app-design-system";
@@ -11,7 +10,7 @@ import { Text, View } from "react-native";
type SpacerViewerBoxProps = {
size: IOSpacer;
- orientation?: SpacerOrientation;
+ orientation?: "vertical" | "horizontal";
};
const SpacerLabel = ({ value }: { value: IOSpacer }) => {
diff --git a/src/components/spacer/Spacer.tsx b/src/components/spacer/Spacer.tsx
index e6f56584..8ad4cb59 100644
--- a/src/components/spacer/Spacer.tsx
+++ b/src/components/spacer/Spacer.tsx
@@ -2,10 +2,8 @@ import React from "react";
import { View } from "react-native";
import { hexToRgba, IOColors, IOSpacer } from "../../core";
-export type SpacerOrientation = "vertical" | "horizontal";
-
type BaseSpacerProps = {
- orientation: SpacerOrientation;
+ orientation: "vertical" | "horizontal";
size: IOSpacer;
};
@@ -21,7 +19,7 @@ const debugBg = hexToRgba(IOColors.red, 0.2);
/**
Native `Spacer` component
-@param {SpacerOrientation} orientation
+@param {string} orientation
@param {IOSpacer} size
*/
const Spacer = ({ orientation, size }: BaseSpacerProps) => {
diff --git a/src/components/stack/Stack.tsx b/src/components/stack/Stack.tsx
index 81bf6774..9ad2a873 100644
--- a/src/components/stack/Stack.tsx
+++ b/src/components/stack/Stack.tsx
@@ -1,27 +1,36 @@
-import React, { ReactNode } from "react";
+import React, { PropsWithChildren } from "react";
import { View, ViewStyle } from "react-native";
import { IOSpacer } from "../../core";
type AllowedStyleProps = Pick<
ViewStyle,
- "alignItems" | "flexShrink" | "flexGrow" | "flex" | "flexWrap"
+ "alignItems" | "flexShrink" | "flexGrow" | "flex" | "flexWrap" | "width"
>;
-type Stack = {
+type Stack = PropsWithChildren<{
space?: IOSpacer;
- children: ReactNode;
style?: AllowedStyleProps;
+}>;
+
+type BaseStack = Stack & {
+ orientation: "vertical" | "horizontal";
};
/**
Horizontal Stack component
@param {IOSpacer} space
*/
-export const HStack = ({ space, children, style }: Stack) => (
+
+const Stack = ({
+ space,
+ style,
+ orientation = "vertical",
+ children
+}: BaseStack) => (
(
);
+export const HStack = ({ children, ...props }: Stack) => (
+
+ {children}
+
+);
+
/**
Vertical Stack component
@param {IOSpacer} space
*/
-export const VStack = ({ space, children, style }: Stack) => (
-
+export const VStack = ({ children, ...props }: Stack) => (
+
{children}
-
+
);