@umituz/react-native-bottom-sheet 1.2.5 → 1.2.6

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.5",
3
+ "version": "1.2.6",
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",
@@ -30,7 +30,6 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@gorhom/bottom-sheet": ">=5.0.0",
33
- "@umituz/react-native-animation": "*",
34
33
  "@umituz/react-native-design-system": "*",
35
34
  "@umituz/react-native-design-system-theme": "*",
36
35
  "react": ">=18.2.0",
@@ -43,7 +42,6 @@
43
42
  "@react-native-async-storage/async-storage": "^2.2.0",
44
43
  "@types/react": "^18.2.45",
45
44
  "@types/react-native": "^0.73.0",
46
- "@umituz/react-native-animation": "latest",
47
45
  "@umituz/react-native-design-system": "latest",
48
46
  "@umituz/react-native-design-system-theme": "latest",
49
47
  "react": "^18.2.0",
@@ -37,7 +37,6 @@ import GorhomBottomSheet, {
37
37
  type BottomSheetBackdropProps,
38
38
  } from '@gorhom/bottom-sheet';
39
39
  import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
40
- import { useReanimatedReady } from '@umituz/react-native-animation';
41
40
  import type {
42
41
  BottomSheetConfig,
43
42
  BottomSheetPreset,
@@ -155,8 +154,6 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
155
154
  ) => {
156
155
  const tokens = useAppDesignTokens();
157
156
  const sheetRef = React.useRef<GorhomBottomSheet>(null);
158
- // Don't render until Reanimated is ready to prevent layoutState.get errors
159
- const isReanimatedReady = useReanimatedReady();
160
157
 
161
158
  // Get configuration from preset or custom (must be before useImperativeHandle)
162
159
  const config: BottomSheetConfig = useMemo(() => {
@@ -213,8 +210,7 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
213
210
  [onChange, onClose]
214
211
  );
215
212
 
216
- // Expose ref methods (must be before early return to maintain hook order)
217
- // No need to check isReanimatedReady here - component won't render if not ready
213
+ // Expose ref methods
218
214
  React.useImperativeHandle(ref, () => ({
219
215
  snapToIndex: (index: number) => {
220
216
  sheetRef.current?.snapToIndex(index);
@@ -233,11 +229,6 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
233
229
  },
234
230
  }), []);
235
231
 
236
- // Don't render until Reanimated is ready
237
- if (!isReanimatedReady) {
238
- return null;
239
- }
240
-
241
232
  // Ensure valid config
242
233
  if (!config.snapPoints || config.snapPoints.length === 0) {
243
234
  return null;
@@ -39,7 +39,6 @@ import {
39
39
  type BottomSheetBackdropProps,
40
40
  } from '@gorhom/bottom-sheet';
41
41
  import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
42
- import { useReanimatedReady } from '@umituz/react-native-animation';
43
42
  import type {
44
43
  BottomSheetConfig,
45
44
  BottomSheetPreset,
@@ -157,8 +156,6 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
157
156
  ) => {
158
157
  const tokens = useAppDesignTokens();
159
158
  const modalRef = React.useRef<GorhomBottomSheetModal>(null);
160
- // Use centralized Reanimated ready check from animation package
161
- const isMounted = useReanimatedReady();
162
159
 
163
160
  // Get configuration from preset or custom (must be before useImperativeHandle)
164
161
  const config: BottomSheetConfig = useMemo(() => {
@@ -215,49 +212,27 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
215
212
  [onChange, onDismiss]
216
213
  );
217
214
 
218
- // Expose ref methods (must be before early return to maintain hook order)
215
+ // Expose ref methods
219
216
  React.useImperativeHandle(ref, () => ({
220
217
  present: () => {
221
- // @gorhom/bottom-sheet's present() automatically opens from bottom to first snap point
222
- // useReanimatedReady() ensures GorhomBottomSheetModal is only rendered when Reanimated is ready
223
- // So we can safely call present() without additional delays
224
- if (isMounted && modalRef.current) {
225
- modalRef.current.present();
226
- }
218
+ modalRef.current?.present();
227
219
  },
228
220
  dismiss: () => {
229
- if (isMounted) {
230
221
  modalRef.current?.dismiss();
231
- }
232
222
  },
233
223
  snapToIndex: (index: number) => {
234
- if (isMounted) {
235
224
  modalRef.current?.snapToIndex(index);
236
- }
237
225
  },
238
226
  snapToPosition: (position: string | number) => {
239
- if (isMounted) {
240
227
  modalRef.current?.snapToPosition(position);
241
- }
242
228
  },
243
229
  expand: () => {
244
- if (isMounted) {
245
230
  modalRef.current?.expand();
246
- }
247
231
  },
248
232
  collapse: () => {
249
- if (isMounted) {
250
233
  modalRef.current?.collapse();
251
- }
252
234
  },
253
- }));
254
-
255
- // Don't render until mounted to prevent early hook execution
256
- // This ensures @gorhom/bottom-sheet's internal hooks don't run before Reanimated is ready
257
- // IMPORTANT: All hooks must be called before this early return to maintain hook order
258
- if (!isMounted) {
259
- return null;
260
- }
235
+ }), []);
261
236
 
262
237
  return (
263
238
  <GorhomBottomSheetModal
@@ -18,7 +18,6 @@
18
18
 
19
19
  import React from 'react';
20
20
  import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
21
- import { useReanimatedReady } from '@umituz/react-native-animation';
22
21
 
23
22
  interface SafeBottomSheetModalProviderProps {
24
23
  children: React.ReactNode;
@@ -27,20 +26,11 @@ interface SafeBottomSheetModalProviderProps {
27
26
  /**
28
27
  * SafeBottomSheetModalProvider
29
28
  *
30
- * Delays rendering of BottomSheetModalProvider until Reanimated is ready.
31
- * This prevents layoutState.get errors during initial render.
29
+ * Wrapper around BottomSheetModalProvider for consistency.
32
30
  */
33
31
  export const SafeBottomSheetModalProvider: React.FC<SafeBottomSheetModalProviderProps> = ({
34
32
  children,
35
33
  }) => {
36
- // Use centralized Reanimated ready check from animation package
37
- const isReanimatedReady = useReanimatedReady();
38
-
39
- // Don't render BottomSheetModalProvider until Reanimated is ready
40
- if (!isReanimatedReady) {
41
- return <>{children}</>;
42
- }
43
-
44
34
  return <BottomSheetModalProvider>{children}</BottomSheetModalProvider>;
45
35
  };
46
36
 
@@ -37,7 +37,7 @@ export interface UseBottomSheetReturn {
37
37
  /**
38
38
  * Ref to attach to BottomSheet component
39
39
  */
40
- sheetRef: React.RefObject<BottomSheetRef>;
40
+ sheetRef: React.RefObject<BottomSheetRef | null>;
41
41
 
42
42
  /**
43
43
  * Open bottom sheet to initial index
@@ -37,7 +37,7 @@ export interface UseBottomSheetModalReturn {
37
37
  /**
38
38
  * Ref to attach to BottomSheetModal component
39
39
  */
40
- modalRef: React.RefObject<BottomSheetModalRef>;
40
+ modalRef: React.RefObject<BottomSheetModalRef | null>;
41
41
 
42
42
  /**
43
43
  * Present bottom sheet modal