File tree Expand file tree Collapse file tree
packages/design-system-react-native/src/components/Toast Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,13 +22,6 @@ export type ToastSeverity = (typeof ToastSeverity)[keyof typeof ToastSeverity];
2222 */
2323export type ToastIconProps = Omit < IconProps , 'name' | 'size' | 'color' > ;
2424
25- /**
26- * Optional props for the close `ButtonIcon`.
27- */
28- export type ToastCloseButtonProps = NonNullable <
29- BannerBaseProps [ 'closeButtonProps' ]
30- > ;
31-
3225/**
3326 * Shared toast props aligned with BannerBase, plus optional severity/icon props.
3427 */
Original file line number Diff line number Diff line change @@ -39,12 +39,11 @@ const screenHeight = Dimensions.get('window').height;
3939
4040let registeredRef : RefObject < ToasterRef > | null = null ;
4141
42- const assertRegisteredRef = ( method : 'hide' | 'show' | 'toast' ) : ToasterRef => {
42+ const assertRegisteredRef = (
43+ method : 'hide' | 'show' | 'toast' | 'dismiss' ,
44+ ) : ToasterRef => {
4345 if ( ! registeredRef ?. current ) {
44- const invocation =
45- method === 'toast'
46- ? 'toast()'
47- : `toast.${ method === 'hide' ? 'hide' : 'show' } ()` ;
46+ const invocation = method === 'toast' ? 'toast()' : `toast.${ method } ()` ;
4847 throw new Error (
4948 `${ invocation } called before <Toaster /> mounted. Render <Toaster /> once at the root of your app.` ,
5049 ) ;
@@ -175,7 +174,7 @@ const ToasterComponent = forwardRef<ToasterRef, ToasterProps>(
175174 closeToast ( ) ;
176175 toastOnClose ?.( ) ;
177176 } }
178- twClassName = { twClassName }
177+ twClassName = { toastProps . twClassName ?? twClassName }
179178 />
180179 </ Animated . View >
181180 ) ;
@@ -205,5 +204,5 @@ toast.hide = () => {
205204} ;
206205
207206toast . dismiss = ( ) => {
208- assertRegisteredRef ( 'hide ' ) . closeToast ( ) ;
207+ assertRegisteredRef ( 'dismiss ' ) . closeToast ( ) ;
209208} ;
You can’t perform that action at this time.
0 commit comments