@umituz/react-native-bottom-sheet 1.1.5 → 1.1.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.1.
|
|
3
|
+
"version": "1.1.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",
|
|
@@ -158,6 +158,35 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
|
|
|
158
158
|
const modalRef = React.useRef<GorhomBottomSheetModal>(null);
|
|
159
159
|
const [isMounted, setIsMounted] = useState(false);
|
|
160
160
|
|
|
161
|
+
// Get configuration from preset or custom (must be before useImperativeHandle)
|
|
162
|
+
const config: BottomSheetConfig = useMemo(() => {
|
|
163
|
+
if (customSnapPoints) {
|
|
164
|
+
return BottomSheetUtils.createConfig({
|
|
165
|
+
snapPoints: customSnapPoints,
|
|
166
|
+
initialIndex,
|
|
167
|
+
enableBackdrop,
|
|
168
|
+
backdropAppearsOnIndex,
|
|
169
|
+
backdropDisappearsOnIndex,
|
|
170
|
+
keyboardBehavior,
|
|
171
|
+
enableHandleIndicator,
|
|
172
|
+
enablePanDownToClose,
|
|
173
|
+
enableDynamicSizing,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return BottomSheetUtils.getPreset(preset);
|
|
177
|
+
}, [
|
|
178
|
+
preset,
|
|
179
|
+
customSnapPoints,
|
|
180
|
+
initialIndex,
|
|
181
|
+
enableBackdrop,
|
|
182
|
+
backdropAppearsOnIndex,
|
|
183
|
+
backdropDisappearsOnIndex,
|
|
184
|
+
keyboardBehavior,
|
|
185
|
+
enableHandleIndicator,
|
|
186
|
+
enablePanDownToClose,
|
|
187
|
+
enableDynamicSizing,
|
|
188
|
+
]);
|
|
189
|
+
|
|
161
190
|
// Ensure component is mounted after Reanimated is ready
|
|
162
191
|
// This prevents layoutState.get errors during initial render
|
|
163
192
|
// @gorhom/bottom-sheet uses useAnimatedDetents which accesses layoutState.get
|
|
@@ -185,13 +214,9 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
|
|
|
185
214
|
// Expose ref methods
|
|
186
215
|
React.useImperativeHandle(ref, () => ({
|
|
187
216
|
present: () => {
|
|
188
|
-
if (isMounted) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const initialIdx = initialIndex ?? config.initialIndex ?? 0;
|
|
192
|
-
setTimeout(() => {
|
|
193
|
-
modalRef.current?.snapToIndex(initialIdx);
|
|
194
|
-
}, 100);
|
|
217
|
+
if (isMounted && modalRef.current) {
|
|
218
|
+
// @gorhom/bottom-sheet's present() automatically opens from bottom to first snap point
|
|
219
|
+
modalRef.current.present();
|
|
195
220
|
}
|
|
196
221
|
},
|
|
197
222
|
dismiss: () => {
|