Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable invariant check for bottomSheetIntegrated in V5, so we can use StyledBottomSheetFlatList and BottomSheetFlashList #1767

Closed
Acetyld opened this issue Mar 11, 2024 · 1 comment

Comments

@Acetyld
Copy link

Acetyld commented Mar 11, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @gorhom/bottom-sheet@5.0.0-alpha.9 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/usePropsValidator.js b/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/usePropsValidator.js
index 4e664c4..6545d47 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/usePropsValidator.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/commonjs/hooks/usePropsValidator.js
@@ -45,11 +45,11 @@ const usePropsValidator = ({
     // animations
   }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);
   (0, _react.useMemo)(() => {
-    (0, _invariant.default)(enableDynamicSizing && children &&
+    (0, _invariant.default)(enableDynamicSizing && children)
     // @ts-ignore
-    children.type &&
+    // 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`);
+    // 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]);
 };
 exports.usePropsValidator = usePropsValidator;
diff --git a/node_modules/@gorhom/bottom-sheet/lib/module/hooks/usePropsValidator.js b/node_modules/@gorhom/bottom-sheet/lib/module/hooks/usePropsValidator.js
index f27d979..24a1771 100644
--- a/node_modules/@gorhom/bottom-sheet/lib/module/hooks/usePropsValidator.js
+++ b/node_modules/@gorhom/bottom-sheet/lib/module/hooks/usePropsValidator.js
@@ -37,12 +37,12 @@ export const usePropsValidator = ({
 
     // animations
   }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);
-  useMemo(() => {
-    invariant(enableDynamicSizing && children &&
+  // useMemo(() => {
+  //   invariant(enableDynamicSizing && children)
     // @ts-ignore
-    children.type &&
+    // 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]);
+    // 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]);
 };
 //# sourceMappingURL=usePropsValidator.js.map
diff --git a/node_modules/@gorhom/bottom-sheet/src/hooks/usePropsValidator.ts b/node_modules/@gorhom/bottom-sheet/src/hooks/usePropsValidator.ts
index 7079f1d..15dfda3 100644
--- a/node_modules/@gorhom/bottom-sheet/src/hooks/usePropsValidator.ts
+++ b/node_modules/@gorhom/bottom-sheet/src/hooks/usePropsValidator.ts
@@ -85,17 +85,17 @@ export const usePropsValidator = ({
     // animations
   }, [index, snapPoints, topInset, bottomInset, enableDynamicSizing]);
 
-  useMemo(() => {
-    invariant(
-      (enableDynamicSizing &&
-        children &&
+  // useMemo(() => {
+    // invariant(
+    //   (enableDynamicSizing &&
+    //     children &&
         // @ts-ignore
-        children.type &&
+        // 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]);
+        // 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]);
 };

This issue body was partially generated by patch-package.

Copy link

@Acetyld: hello! 👋

This issue is being automatically closed because it does not follow the issue template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant