@lodev09/react-native-true-sheet 3.9.5 → 3.9.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.
|
@@ -65,12 +65,15 @@ class TrueSheetCoordinatorLayout(context: Context) :
|
|
|
65
65
|
get() = PointerEvents.BOX_NONE
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Clears stale `nestedScrollingChildRef` from BottomSheetBehavior.
|
|
68
|
+
* Clears stale `nestedScrollingChildRef` from BottomSheetBehavior and forces re-discovery.
|
|
69
69
|
*
|
|
70
70
|
* `BottomSheetBehavior.onLayoutChild` calls `findScrollingChild()` which traverses the
|
|
71
|
-
* entire sheet subtree.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
71
|
+
* entire sheet subtree. The cached `nestedScrollingChildRef` can become stale when:
|
|
72
|
+
* 1. A child sheet with a ScrollView is dismissed and its ScrollView returns to this hierarchy
|
|
73
|
+
* 2. A ScrollView is conditionally removed and re-added (e.g. React conditional rendering)
|
|
74
|
+
*
|
|
75
|
+
* When stale (GC'd target or view no longer in sheet), we clear the ref and request layout
|
|
76
|
+
* so `onLayoutChild` re-runs `findScrollingChild()` to discover the current ScrollView.
|
|
74
77
|
*/
|
|
75
78
|
private fun clearStaleNestedScrollingChildRef() {
|
|
76
79
|
val sheet = delegate?.findSheetView() ?: return
|
|
@@ -80,9 +83,10 @@ class TrueSheetCoordinatorLayout(context: Context) :
|
|
|
80
83
|
field.isAccessible = true
|
|
81
84
|
@Suppress("UNCHECKED_CAST")
|
|
82
85
|
val ref = field.get(behavior) as? java.lang.ref.WeakReference<android.view.View> ?: return
|
|
83
|
-
val view = ref.get()
|
|
84
|
-
if (!view.isDescendantOf(sheet)) {
|
|
86
|
+
val view = ref.get()
|
|
87
|
+
if (view == null || !view.isDescendantOf(sheet)) {
|
|
85
88
|
ref.clear()
|
|
89
|
+
sheet.requestLayout()
|
|
86
90
|
}
|
|
87
91
|
} catch (_: Exception) {}
|
|
88
92
|
}
|
package/package.json
CHANGED