Skip to content

Commit 5bb99bb

Browse files
committed
react-native/Toast: prevent internal props leaking; remove internal type export; fix story layout\n\n- Filter out hasNoTimeout and bottomOffset before rendering <Toast> to avoid unknown prop warnings on native View\n- Stop exporting internal ToastSharedProps from Toast entrypoint and components barrel\n- Replace raw View + inline style with Box gap={2} in story per design token guidelines
1 parent 457e582 commit 5bb99bb

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

packages/design-system-react-native/src/components/Toast/Toast.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from '@storybook/react-native';
22
import React from 'react';
3-
import { View } from 'react-native';
3+
import { Box } from '../Box';
44

55
// External dependencies.
66
import { Icon, IconColor, IconName, IconSize } from '../Icon';
@@ -62,12 +62,12 @@ export const Default: Story = {
6262

6363
export const Severity: Story = {
6464
render: (args) => (
65-
<View style={{ gap: 8 }}>
65+
<Box gap={2}>
6666
<Toast {...args} severity={ToastSeverity.Default} text="Default" />
6767
<Toast {...args} severity={ToastSeverity.Success} text="Success" />
6868
<Toast {...args} severity={ToastSeverity.Warning} text="Warning" />
6969
<Toast {...args} severity={ToastSeverity.Error} text="Error" />
70-
</View>
70+
</Box>
7171
),
7272
args: {
7373
description: 'Severity controls the default start accessory icon.',

packages/design-system-react-native/src/components/Toast/Toaster.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ const ToasterComponent = forwardRef<ToasterRef, ToasterProps>(
120120
return null;
121121
}
122122

123+
// Filter out internal-only options that should not reach native views.
124+
const {
125+
hasNoTimeout: _ignoredHasNoTimeout,
126+
bottomOffset: _ignoredBottomOffset,
127+
...toastForwardProps
128+
} = toastOptions;
129+
123130
const onAnimatedViewLayout = (e: LayoutChangeEvent) => {
124131
const { height } = e.nativeEvent.layout;
125132
const translateYToValue = -(TOAST_BOTTOM_PADDING + bottomNotchSpacing);
@@ -155,7 +162,7 @@ const ToasterComponent = forwardRef<ToasterRef, ToasterProps>(
155162
{...props}
156163
>
157164
<Toast
158-
{...toastOptions}
165+
{...toastForwardProps}
159166
onClose={() => {
160167
closeToast();
161168
toastOptions.onClose?.();

packages/design-system-react-native/src/components/Toast/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export type {
55
ToastOptions,
66
ToastProps,
77
ToastCloseButtonProps,
8-
ToastSharedProps,
98
ToasterProps,
109
ToasterRef,
1110
} from './Toast.types';

packages/design-system-react-native/src/components/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ export type {
218218
ToastOptions,
219219
ToastProps,
220220
ToastCloseButtonProps,
221-
ToastSharedProps,
222221
ToasterProps,
223222
ToasterRef,
224223
} from './Toast';

0 commit comments

Comments
 (0)