From b1d891385eed2bf22ec8f5069d6462530ba98ac2 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 9 Mar 2026 14:21:02 +0200 Subject: [PATCH] fix older android versions --- .../expo/modules/bottomsheet/BottomSheetView.kt | 11 ++++++++--- .../android/src/main/res/values/styles.xml | 6 ++++-- .../bottom-sheet/src/BottomSheetNativeComponent.tsx | 13 ++++++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt b/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt index 1a1af8e6a8..86a9317874 100644 --- a/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt +++ b/modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt @@ -38,9 +38,13 @@ class BottomSheetView( private var lastObservedContentHeight: Float = 0f private var pendingLayoutUpdate: Boolean = false - private val screenHeight = - context.resources.displayMetrics.heightPixels - .toFloat() + private val screenHeight: Float = + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM) { + context.resources.displayMetrics.heightPixels.toFloat() + } else { + val wm = context.getSystemService(Context.WINDOW_SERVICE) as android.view.WindowManager + wm.currentWindowMetrics.bounds.height().toFloat() + } private fun getNavigationBarHeight(): Int { val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android") @@ -203,6 +207,7 @@ class BottomSheetView( val bottomSheet = dialog.findViewById(com.google.android.material.R.id.design_bottom_sheet) bottomSheet?.let { it.setBackgroundColor(0) + it.elevation = 0f val behavior = BottomSheetBehavior.from(it) behavior.state = BottomSheetBehavior.STATE_HIDDEN diff --git a/modules/bottom-sheet/android/src/main/res/values/styles.xml b/modules/bottom-sheet/android/src/main/res/values/styles.xml index b62f3bd0dd..6bcdaa55bf 100644 --- a/modules/bottom-sheet/android/src/main/res/values/styles.xml +++ b/modules/bottom-sheet/android/src/main/res/values/styles.xml @@ -1,10 +1,12 @@ -