Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix bottom sheet crash on API <30 (#10084)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

authored by

Samuel Newman
Claude Opus 4.6 (1M context)
and committed by
GitHub
288fad67 0e1e790c

+13 -3
+13 -3
modules/bottom-sheet/android/src/main/java/expo/modules/bottomsheet/BottomSheetView.kt
··· 33 33 private var eventDispatcher: EventDispatcher? = null 34 34 35 35 // Native content height observation (eliminates JS bridge round-trip) 36 - private var contentLayoutListener: View.OnLayoutChangeListener? = null 36 + private var contentLayoutListener: OnLayoutChangeListener? = null 37 37 private var observedChildren: List<View> = emptyList() 38 38 private var lastObservedContentHeight: Float = 0f 39 39 private var pendingLayoutUpdate: Boolean = false 40 40 41 41 private val screenHeight: Float = 42 42 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM) { 43 + // API 35+: edge-to-edge is mandatory, heightPixels is the full display 43 44 context.resources.displayMetrics.heightPixels.toFloat() 44 - } else { 45 + } else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) { 46 + // API 30-34: heightPixels may exclude nav bar, use currentWindowMetrics 45 47 val wm = context.getSystemService(Context.WINDOW_SERVICE) as android.view.WindowManager 46 48 wm.currentWindowMetrics.bounds.height().toFloat() 49 + } else { 50 + // API < 30: currentWindowMetrics not available, use getRealSize 51 + // which includes system bars (heightPixels may exclude them) 52 + val wm = context.getSystemService(Context.WINDOW_SERVICE) as android.view.WindowManager 53 + val size = android.graphics.Point() 54 + @Suppress("DEPRECATION") 55 + wm.defaultDisplay.getRealSize(size) 56 + size.y.toFloat() 47 57 } 48 58 49 59 private fun getNavigationBarHeight(): Int { ··· 355 365 356 366 val innerViewGroup = this.innerView as? ViewGroup ?: return 357 367 358 - val listener = View.OnLayoutChangeListener { _, _, top, _, bottom, _, _, oldTop, oldBottom -> 368 + val listener = OnLayoutChangeListener { _, _, top, _, bottom, _, _, oldTop, oldBottom -> 359 369 val newHeight = bottom - top 360 370 val oldHeight = oldBottom - oldTop 361 371 if (newHeight != oldHeight) {