diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index e21a3ca36..1256ba3dd 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -153,7 +153,7 @@ const BottomSheetComponent = forwardRef( backdropComponent, backgroundComponent, footerComponent, - children, + children: Content, } = props; //#endregion @@ -1621,9 +1621,7 @@ const BottomSheetComponent = forwardRef( key="BottomSheetRootDraggableView" style={contentContainerStyle} > - {typeof children === 'function' - ? (children as Function)() - : children} + {typeof Content === 'function' ? : Content} {footerComponent && ( { - setMount(true); + setState({ + mount: true, + data: _data, + }); mountSheet(key, ref, stackBehavior); print({ @@ -348,7 +359,7 @@ const BottomSheetModalComponent = forwardRef< //#endregion // render - // console.log('BottomSheetModal', index, snapPoints) + // console.log('BottomSheetModal', index, mount, data); return mount ? ( : Content + } $modal={true} /> diff --git a/src/components/bottomSheetModal/types.d.ts b/src/components/bottomSheetModal/types.d.ts index 1d6b8271e..e05e451d1 100644 --- a/src/components/bottomSheetModal/types.d.ts +++ b/src/components/bottomSheetModal/types.d.ts @@ -1,3 +1,4 @@ +import type React from 'react'; import type { BottomSheetProps } from '../bottomSheet'; import type { MODAL_STACK_BEHAVIOR } from '../../constants'; @@ -43,4 +44,13 @@ export interface BottomSheetModalProps * @type () => void; */ onDismiss?: () => void; + + /** + * A scrollable node or normal view. + * @type React.ReactNode[] | React.ReactNode + */ + children: + | (({ data: any }?) => React.ReactNode) + | React.ReactNode[] + | React.ReactNode; } diff --git a/src/types.d.ts b/src/types.d.ts index 1b44f1202..2a792c5b2 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -78,8 +78,9 @@ export interface BottomSheetMethods { export interface BottomSheetModalMethods extends BottomSheetMethods { /** * Mount and present the bottom sheet modal to the initial snap point. + * @param data to be passed to the modal. */ - present: () => void; + present: (data?: any) => void; /** * Close and unmount the bottom sheet modal. * @param animationConfigs snap animation configs.