@umituz/react-native-bottom-sheet 1.1.2 → 1.1.3
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.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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",
|
|
@@ -161,23 +161,22 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
|
|
|
161
161
|
// @gorhom/bottom-sheet uses useAnimatedDetents which accesses layoutState.get
|
|
162
162
|
// during initialization, so we need to wait for Reanimated to be fully ready
|
|
163
163
|
useEffect(() => {
|
|
164
|
-
// Use a
|
|
165
|
-
//
|
|
166
|
-
|
|
164
|
+
// Use a longer delay to ensure Reanimated is fully initialized
|
|
165
|
+
// This is critical because @gorhom/bottom-sheet's internal hooks
|
|
166
|
+
// access layoutState.get immediately when the component renders
|
|
167
167
|
const timer = setTimeout(() => {
|
|
168
168
|
// Use multiple animation frames to ensure Reanimated worklets are ready
|
|
169
|
-
|
|
169
|
+
requestAnimationFrame(() => {
|
|
170
170
|
requestAnimationFrame(() => {
|
|
171
|
-
|
|
171
|
+
requestAnimationFrame(() => {
|
|
172
|
+
setIsMounted(true);
|
|
173
|
+
});
|
|
172
174
|
});
|
|
173
175
|
});
|
|
174
|
-
},
|
|
176
|
+
}, 300); // Increased delay to 300ms to ensure Reanimated is fully initialized
|
|
175
177
|
|
|
176
178
|
return () => {
|
|
177
179
|
clearTimeout(timer);
|
|
178
|
-
if (frameId) {
|
|
179
|
-
cancelAnimationFrame(frameId);
|
|
180
|
-
}
|
|
181
180
|
};
|
|
182
181
|
}, []);
|
|
183
182
|
|
|
@@ -210,6 +209,12 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
|
|
|
210
209
|
},
|
|
211
210
|
}));
|
|
212
211
|
|
|
212
|
+
// Don't compute config or callbacks until mounted to prevent early hook execution
|
|
213
|
+
// This ensures @gorhom/bottom-sheet's internal hooks don't run before Reanimated is ready
|
|
214
|
+
if (!isMounted) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
|
|
213
218
|
// Get configuration from preset or custom
|
|
214
219
|
const config: BottomSheetConfig = useMemo(() => {
|
|
215
220
|
if (customSnapPoints) {
|
|
@@ -265,11 +270,6 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
|
|
|
265
270
|
[onChange, onClose]
|
|
266
271
|
);
|
|
267
272
|
|
|
268
|
-
// Don't render until Reanimated is ready to prevent layoutState errors
|
|
269
|
-
if (!isMounted) {
|
|
270
|
-
return null;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
273
|
return (
|
|
274
274
|
<GorhomBottomSheet
|
|
275
275
|
ref={sheetRef}
|
|
@@ -163,23 +163,22 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
|
|
|
163
163
|
// @gorhom/bottom-sheet uses useAnimatedDetents which accesses layoutState.get
|
|
164
164
|
// during initialization, so we need to wait for Reanimated to be fully ready
|
|
165
165
|
useEffect(() => {
|
|
166
|
-
// Use a
|
|
167
|
-
//
|
|
168
|
-
|
|
166
|
+
// Use a longer delay to ensure Reanimated is fully initialized
|
|
167
|
+
// This is critical because @gorhom/bottom-sheet's internal hooks
|
|
168
|
+
// access layoutState.get immediately when the component renders
|
|
169
169
|
const timer = setTimeout(() => {
|
|
170
170
|
// Use multiple animation frames to ensure Reanimated worklets are ready
|
|
171
|
-
|
|
171
|
+
requestAnimationFrame(() => {
|
|
172
172
|
requestAnimationFrame(() => {
|
|
173
|
-
|
|
173
|
+
requestAnimationFrame(() => {
|
|
174
|
+
setIsMounted(true);
|
|
175
|
+
});
|
|
174
176
|
});
|
|
175
177
|
});
|
|
176
|
-
},
|
|
178
|
+
}, 300); // Increased delay to 300ms to ensure Reanimated is fully initialized
|
|
177
179
|
|
|
178
180
|
return () => {
|
|
179
181
|
clearTimeout(timer);
|
|
180
|
-
if (frameId) {
|
|
181
|
-
cancelAnimationFrame(frameId);
|
|
182
|
-
}
|
|
183
182
|
};
|
|
184
183
|
}, []);
|
|
185
184
|
|
|
@@ -217,6 +216,12 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
|
|
|
217
216
|
},
|
|
218
217
|
}));
|
|
219
218
|
|
|
219
|
+
// Don't compute config or callbacks until mounted to prevent early hook execution
|
|
220
|
+
// This ensures @gorhom/bottom-sheet's internal hooks don't run before Reanimated is ready
|
|
221
|
+
if (!isMounted) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
|
|
220
225
|
// Get configuration from preset or custom
|
|
221
226
|
const config: BottomSheetConfig = useMemo(() => {
|
|
222
227
|
if (customSnapPoints) {
|
|
@@ -272,11 +277,6 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
|
|
|
272
277
|
[onChange, onDismiss]
|
|
273
278
|
);
|
|
274
279
|
|
|
275
|
-
// Don't render until Reanimated is ready to prevent layoutState errors
|
|
276
|
-
if (!isMounted) {
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
280
|
return (
|
|
281
281
|
<GorhomBottomSheetModal
|
|
282
282
|
ref={modalRef}
|