@lodev09/react-native-true-sheet 3.5.1-beta.5 → 3.5.1

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.
@@ -309,13 +309,15 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
309
309
  // ==================== Sheet Stack Translation ====================
310
310
 
311
311
  /**
312
- * Updates this sheet's translation based on its child sheet's position.
313
- * When a child sheet is presented, parent sheets slide down to create a stacked appearance.
312
+ * Updates this sheet's translation and disables dragging when a child sheet is presented.
313
+ * Parent sheets slide down to create a stacked appearance.
314
314
  * Propagates additional translation to parent so the entire stack stays visually consistent.
315
315
  */
316
316
  fun updateTranslationForChild(childSheetTop: Int) {
317
317
  if (!viewController.isSheetVisible || viewController.isExpanded) return
318
318
 
319
+ viewController.sheetView?.behavior?.isDraggable = false
320
+
319
321
  val mySheetTop = viewController.detentCalculator.getSheetTopForDetentIndex(viewController.currentDetentIndex)
320
322
  val newTranslation = maxOf(0, childSheetTop - mySheetTop)
321
323
  val additionalTranslation = newTranslation - viewController.currentTranslationY
@@ -332,17 +334,18 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
332
334
  * Recursively adds translation to this sheet and all parent sheets.
333
335
  */
334
336
  private fun addTranslation(amount: Int) {
335
- if (!viewController.isSheetVisible || viewController.isExpanded) return
337
+ if (viewController.isExpanded) return
336
338
 
337
339
  viewController.translateSheet(viewController.currentTranslationY + amount)
338
340
  TrueSheetStackManager.getParentSheet(this)?.addTranslation(amount)
339
341
  }
340
342
 
341
343
  /**
342
- * Resets this sheet's translation and updates parent sheets.
343
- * This sheet resets to 0 (it's now topmost), but parent recalculates based on this sheet's position.
344
+ * Resets this sheet's translation and restores dragging when it becomes topmost.
345
+ * Parent recalculates its translation based on this sheet's position.
344
346
  */
345
347
  fun resetTranslation() {
348
+ viewController.sheetView?.behavior?.isDraggable = viewController.draggable
346
349
  viewController.translateSheet(0)
347
350
 
348
351
  // Parent should recalculate its translation based on this sheet's position
@@ -534,24 +534,25 @@ class TrueSheetViewController(private val reactContext: ThemedReactContext) :
534
534
  }
535
535
 
536
536
  private fun hideForModal() {
537
- isSheetVisible = false
538
- wasHiddenByModal = true
539
-
540
537
  val sheet = sheetView ?: run {
541
- setSheetVisibility(false)
542
- parentSheetView?.viewController?.hideForModal()
538
+ RNLog.e(reactContext, "TrueSheet: sheetView is null in hideForModal")
543
539
  return
544
540
  }
545
541
 
542
+ isSheetVisible = false
543
+ wasHiddenByModal = true
544
+
546
545
  dimViews.forEach { it.animate().alpha(0f).setDuration(MODAL_FADE_DURATION).start() }
547
546
  sheet.animate()
548
547
  .alpha(0f)
549
548
  .setDuration(MODAL_FADE_DURATION)
550
549
  .withEndAction {
551
550
  setSheetVisibility(false)
552
- parentSheetView?.viewController?.hideForModal()
553
551
  }
554
552
  .start()
553
+
554
+ // This will hide parent sheets first
555
+ parentSheetView?.viewController?.hideForModal()
555
556
  }
556
557
 
557
558
  private fun showAfterModal() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "3.5.1-beta.5",
3
+ "version": "3.5.1",
4
4
  "description": "The true native bottom sheet experience for your React Native Apps.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",