@umituz/react-native-bottom-sheet 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-bottom-sheet",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Modern, performant bottom sheets for React Native with preset configurations, keyboard handling, and smooth animations",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -156,6 +156,9 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
156
156
  const tokens = useAppDesignTokens();
157
157
  const sheetRef = React.useRef<GorhomBottomSheet>(null);
158
158
  // Use centralized Reanimated ready check from animation package
159
+ // CRITICAL: This must be true before GorhomBottomSheet is rendered
160
+ // Otherwise, internal hooks (useAnimatedLayout) will access containerLayoutState.get
161
+ // before Reanimated is ready, causing "containerLayoutState.get is not a function" errors
159
162
  const isMounted = useReanimatedReady();
160
163
 
161
164
  // Get configuration from preset or custom (must be before useImperativeHandle)
@@ -242,13 +245,21 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
242
245
  },
243
246
  }));
244
247
 
245
- // Don't render until mounted to prevent early hook execution
246
- // This ensures @gorhom/bottom-sheet's internal hooks don't run before Reanimated is ready
248
+ // CRITICAL: Don't render GorhomBottomSheet until Reanimated is fully ready
249
+ // GorhomBottomSheet's internal hooks (useAnimatedLayout, useAnimatedDetents, etc.)
250
+ // access Reanimated's containerLayoutState.get during initialization
251
+ // If we render before Reanimated is ready, we get "containerLayoutState.get is not a function" errors
247
252
  // IMPORTANT: All hooks must be called before this early return to maintain hook order
248
253
  if (!isMounted) {
249
254
  return null;
250
255
  }
251
256
 
257
+ // Double-check: Ensure we have a valid config before rendering
258
+ // This prevents errors if snapPoints are invalid
259
+ if (!config.snapPoints || config.snapPoints.length === 0) {
260
+ return null;
261
+ }
262
+
252
263
  return (
253
264
  <GorhomBottomSheet
254
265
  ref={sheetRef}