@swmansion/react-native-bottom-sheet 0.15.0-next.7 → 0.15.0-next.8
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.
|
@@ -825,12 +825,42 @@ class BottomSheetHostView(context: Context) : ReactViewGroup(context) {
|
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
if (
|
|
828
|
+
if (isVerticallyScrollable(view)) {
|
|
829
829
|
return view
|
|
830
830
|
}
|
|
831
831
|
return null
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
+
private fun isVerticallyScrollable(view: View): Boolean {
|
|
835
|
+
if (!view.canScrollVertically(1) && !view.canScrollVertically(-1)) {
|
|
836
|
+
return false
|
|
837
|
+
}
|
|
838
|
+
return getReactScrollEnabled(view) != false
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
private fun getReactScrollEnabled(view: View): Boolean? {
|
|
842
|
+
val method =
|
|
843
|
+
try {
|
|
844
|
+
view.javaClass.getMethod("getScrollEnabled")
|
|
845
|
+
} catch (_: NoSuchMethodException) {
|
|
846
|
+
return null
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
if (
|
|
850
|
+
method.returnType != Boolean::class.javaPrimitiveType &&
|
|
851
|
+
method.returnType != Boolean::class.javaObjectType
|
|
852
|
+
) {
|
|
853
|
+
return null
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
return try {
|
|
857
|
+
method.isAccessible = true
|
|
858
|
+
method.invoke(view) as? Boolean
|
|
859
|
+
} catch (_: Exception) {
|
|
860
|
+
null
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
834
864
|
private fun isViewInverted(view: View): Boolean {
|
|
835
865
|
val values = FloatArray(9)
|
|
836
866
|
var current: View? = view
|
|
@@ -620,6 +620,7 @@ public final class BottomSheetHostingView: UIView {
|
|
|
620
620
|
}
|
|
621
621
|
|
|
622
622
|
private func isVerticallyScrollable(_ scrollView: UIScrollView) -> Bool {
|
|
623
|
+
guard scrollView.isScrollEnabled else { return false }
|
|
623
624
|
let verticalInset = scrollView.adjustedContentInset.top + scrollView.adjustedContentInset.bottom
|
|
624
625
|
let visibleHeight = max(0, scrollView.bounds.height - verticalInset)
|
|
625
626
|
return scrollView.alwaysBounceVertical || scrollView.contentSize.height > visibleHeight
|
package/package.json
CHANGED