Skip to content

Commit

Permalink
revert(8b62dca): added error message when dynamic sizing enabled with…
Browse files Browse the repository at this point in the history
… a wrong children type
  • Loading branch information
gorhom committed May 19, 2024
1 parent 697f7b7 commit 5714c1c
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 32 deletions.
1 change: 0 additions & 1 deletion src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
enableDynamicSizing,
topInset,
bottomInset,
children,
});
}
//#endregion
Expand Down
2 changes: 0 additions & 2 deletions src/components/bottomSheetScrollable/BottomSheetFlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const BottomSheetFlatListComponent = createBottomSheetScrollableComponent<

const BottomSheetFlatList = memo(BottomSheetFlatListComponent);
BottomSheetFlatList.displayName = 'BottomSheetFlatList';
//@ts-ignore
BottomSheetFlatList.$bottomSheetIntegrated = true;

export default BottomSheetFlatList as <T>(
props: BottomSheetFlatListProps<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ const BottomSheetSectionListComponent = createBottomSheetScrollableComponent<

const BottomSheetSectionList = memo(BottomSheetSectionListComponent);
BottomSheetSectionList.displayName = 'BottomSheetSectionList';
//@ts-ignore
BottomSheetSectionList.$bottomSheetIntegrated = true;

export default BottomSheetSectionList as <ItemT, SectionT = DefaultSectionT>(
props: BottomSheetSectionListProps<ItemT, SectionT>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const BottomSheetVirtualizedListComponent =

const BottomSheetVirtualizedList = memo(BottomSheetVirtualizedListComponent);
BottomSheetVirtualizedList.displayName = 'BottomSheetVirtualizedList';
//@ts-ignore
BottomSheetVirtualizedList.$bottomSheetIntegrated = true;

export default BottomSheetVirtualizedList as <T>(
props: BottomSheetVirtualizedListProps<T>
Expand Down
2 changes: 0 additions & 2 deletions src/components/bottomSheetView/BottomSheetView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,5 @@ function BottomSheetViewComponent({

const BottomSheetView = memo(BottomSheetViewComponent);
BottomSheetView.displayName = 'BottomSheetView';
//@ts-ignore
BottomSheetView.$bottomSheetIntegrated = true;

export default BottomSheetView;
22 changes: 1 addition & 21 deletions src/hooks/usePropsValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]);
};

0 comments on commit 5714c1c

Please sign in to comment.