From 5714c1c850b66da9c9a0e8d08522a66076b35793 Mon Sep 17 00:00:00 2001 From: gorhom Date: Sun, 19 May 2024 18:18:54 +0200 Subject: [PATCH] revert(8b62dca): added error message when dynamic sizing enabled with a wrong children type --- src/components/bottomSheet/BottomSheet.tsx | 1 - .../BottomSheetFlatList.tsx | 2 -- .../BottomSheetScrollView.tsx | 2 -- .../BottomSheetSectionList.tsx | 2 -- .../BottomSheetVirtualizedList.tsx | 2 -- .../bottomSheetView/BottomSheetView.tsx | 2 -- src/hooks/usePropsValidator.ts | 22 +------------------ 7 files changed, 1 insertion(+), 32 deletions(-) diff --git a/src/components/bottomSheet/BottomSheet.tsx b/src/components/bottomSheet/BottomSheet.tsx index c539c446..2c82d536 100644 --- a/src/components/bottomSheet/BottomSheet.tsx +++ b/src/components/bottomSheet/BottomSheet.tsx @@ -176,7 +176,6 @@ const BottomSheetComponent = forwardRef( enableDynamicSizing, topInset, bottomInset, - children, }); } //#endregion diff --git a/src/components/bottomSheetScrollable/BottomSheetFlatList.tsx b/src/components/bottomSheetScrollable/BottomSheetFlatList.tsx index 696ce3b1..6d3c1b79 100644 --- a/src/components/bottomSheetScrollable/BottomSheetFlatList.tsx +++ b/src/components/bottomSheetScrollable/BottomSheetFlatList.tsx @@ -21,8 +21,6 @@ const BottomSheetFlatListComponent = createBottomSheetScrollableComponent< const BottomSheetFlatList = memo(BottomSheetFlatListComponent); BottomSheetFlatList.displayName = 'BottomSheetFlatList'; -//@ts-ignore -BottomSheetFlatList.$bottomSheetIntegrated = true; export default BottomSheetFlatList as ( props: BottomSheetFlatListProps diff --git a/src/components/bottomSheetScrollable/BottomSheetScrollView.tsx b/src/components/bottomSheetScrollable/BottomSheetScrollView.tsx index a8e4c86e..6463c4dd 100644 --- a/src/components/bottomSheetScrollable/BottomSheetScrollView.tsx +++ b/src/components/bottomSheetScrollable/BottomSheetScrollView.tsx @@ -21,8 +21,6 @@ const BottomSheetScrollViewComponent = createBottomSheetScrollableComponent< const BottomSheetScrollView = memo(BottomSheetScrollViewComponent); BottomSheetScrollView.displayName = 'BottomSheetScrollView'; -//@ts-ignore -BottomSheetScrollView.$bottomSheetIntegrated = true; export default BottomSheetScrollView as ( props: BottomSheetScrollViewProps diff --git a/src/components/bottomSheetScrollable/BottomSheetSectionList.tsx b/src/components/bottomSheetScrollable/BottomSheetSectionList.tsx index 0576c07d..6e046f19 100644 --- a/src/components/bottomSheetScrollable/BottomSheetSectionList.tsx +++ b/src/components/bottomSheetScrollable/BottomSheetSectionList.tsx @@ -22,8 +22,6 @@ const BottomSheetSectionListComponent = createBottomSheetScrollableComponent< const BottomSheetSectionList = memo(BottomSheetSectionListComponent); BottomSheetSectionList.displayName = 'BottomSheetSectionList'; -//@ts-ignore -BottomSheetSectionList.$bottomSheetIntegrated = true; export default BottomSheetSectionList as ( props: BottomSheetSectionListProps diff --git a/src/components/bottomSheetScrollable/BottomSheetVirtualizedList.tsx b/src/components/bottomSheetScrollable/BottomSheetVirtualizedList.tsx index e09819fe..df2ad015 100644 --- a/src/components/bottomSheetScrollable/BottomSheetVirtualizedList.tsx +++ b/src/components/bottomSheetScrollable/BottomSheetVirtualizedList.tsx @@ -24,8 +24,6 @@ const BottomSheetVirtualizedListComponent = const BottomSheetVirtualizedList = memo(BottomSheetVirtualizedListComponent); BottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList'; -//@ts-ignore -BottomSheetVirtualizedList.$bottomSheetIntegrated = true; export default BottomSheetVirtualizedList as ( props: BottomSheetVirtualizedListProps diff --git a/src/components/bottomSheetView/BottomSheetView.tsx b/src/components/bottomSheetView/BottomSheetView.tsx index 7a851feb..2199b113 100644 --- a/src/components/bottomSheetView/BottomSheetView.tsx +++ b/src/components/bottomSheetView/BottomSheetView.tsx @@ -99,7 +99,5 @@ function BottomSheetViewComponent({ const BottomSheetView = memo(BottomSheetViewComponent); BottomSheetView.displayName = 'BottomSheetView'; -//@ts-ignore -BottomSheetView.$bottomSheetIntegrated = true; export default BottomSheetView; diff --git a/src/hooks/usePropsValidator.ts b/src/hooks/usePropsValidator.ts index 7079f1d6..7d80c93b 100644 --- a/src/hooks/usePropsValidator.ts +++ b/src/hooks/usePropsValidator.ts @@ -14,15 +14,9 @@ export const usePropsValidator = ({ enableDynamicSizing, topInset, bottomInset, - children, }: Pick< BottomSheetProps, - | 'index' - | 'snapPoints' - | 'enableDynamicSizing' - | 'topInset' - | 'bottomInset' - | 'children' + 'index' | 'snapPoints' | 'enableDynamicSizing' | 'topInset' | 'bottomInset' >) => { useMemo(() => { //#region snap points @@ -84,18 +78,4 @@ export const usePropsValidator = ({ // animations }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]); - - useMemo(() => { - invariant( - (enableDynamicSizing && - children && - // @ts-ignore - children.type && - // @ts-ignore - children.type.$bottomSheetIntegrated) || - !enableDynamicSizing, - `'enableDynamicSizing' is enabled but children type is not integrated with the library !` + - ` expected children types are\n- BottomSheetView\n- BottomSheetFlatList\n- BottomSheetScrollView\n- BottomSheetSectionList\n- BottomSheetVirtualizedList` - ); - }, [enableDynamicSizing, children]); };