@umituz/react-native-bottom-sheet 1.1.3 → 1.1.4

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",
3
+ "version": "1.1.4",
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",
@@ -184,27 +184,27 @@ export const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(
184
184
  React.useImperativeHandle(ref, () => ({
185
185
  snapToIndex: (index: number) => {
186
186
  if (isMounted) {
187
- sheetRef.current?.snapToIndex(index);
187
+ sheetRef.current?.snapToIndex(index);
188
188
  }
189
189
  },
190
190
  snapToPosition: (position: string | number) => {
191
191
  if (isMounted) {
192
- sheetRef.current?.snapToPosition(position);
192
+ sheetRef.current?.snapToPosition(position);
193
193
  }
194
194
  },
195
195
  expand: () => {
196
196
  if (isMounted) {
197
- sheetRef.current?.expand();
197
+ sheetRef.current?.expand();
198
198
  }
199
199
  },
200
200
  collapse: () => {
201
201
  if (isMounted) {
202
- sheetRef.current?.collapse();
202
+ sheetRef.current?.collapse();
203
203
  }
204
204
  },
205
205
  close: () => {
206
206
  if (isMounted) {
207
- sheetRef.current?.close();
207
+ sheetRef.current?.close();
208
208
  }
209
209
  },
210
210
  }));
@@ -187,31 +187,36 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
187
187
  present: () => {
188
188
  if (isMounted) {
189
189
  modalRef.current?.present();
190
+ // Snap to initial index after presenting
191
+ const initialIdx = initialIndex ?? config.initialIndex ?? 0;
192
+ setTimeout(() => {
193
+ modalRef.current?.snapToIndex(initialIdx);
194
+ }, 100);
190
195
  }
191
196
  },
192
197
  dismiss: () => {
193
198
  if (isMounted) {
194
- modalRef.current?.dismiss();
199
+ modalRef.current?.dismiss();
195
200
  }
196
201
  },
197
202
  snapToIndex: (index: number) => {
198
203
  if (isMounted) {
199
- modalRef.current?.snapToIndex(index);
204
+ modalRef.current?.snapToIndex(index);
200
205
  }
201
206
  },
202
207
  snapToPosition: (position: string | number) => {
203
208
  if (isMounted) {
204
- modalRef.current?.snapToPosition(position);
209
+ modalRef.current?.snapToPosition(position);
205
210
  }
206
211
  },
207
212
  expand: () => {
208
213
  if (isMounted) {
209
- modalRef.current?.expand();
214
+ modalRef.current?.expand();
210
215
  }
211
216
  },
212
217
  collapse: () => {
213
218
  if (isMounted) {
214
- modalRef.current?.collapse();
219
+ modalRef.current?.collapse();
215
220
  }
216
221
  },
217
222
  }));
@@ -280,7 +285,7 @@ export const BottomSheetModal = forwardRef<BottomSheetModalRef, BottomSheetModal
280
285
  return (
281
286
  <GorhomBottomSheetModal
282
287
  ref={modalRef}
283
- index={config.initialIndex ?? 0}
288
+ index={-1}
284
289
  snapPoints={config.snapPoints}
285
290
  enableDynamicSizing={config.enableDynamicSizing}
286
291
  backdropComponent={renderBackdrop}