From 2035cd4c82b5f31203bf15125ba93dcf635f9cf4 Mon Sep 17 00:00:00 2001 From: Alan Lee Date: Thu, 31 Oct 2024 10:28:27 -0700 Subject: [PATCH] fix Modal content being cut off when Activity is edge-to-edge Summary: Fixing issue raised in https://github.com/facebook/react-native/issues/47307 This is a follow up from D62286026. It appears there was a line that went missing while trying to refactor the code. `fitsSystemWindows = true` is needeod for < API 30 to avoid content rendering under the system bars when Modal is shown with Activity that is edge-to-edge. Changelog: [Android][Fixed] Fix Regression - Modal content rendering below system bar on < API 30 when activity is edge-to-edge Differential Revision: D65280014 --- .../com/facebook/react/views/modal/ReactModalHostView.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt index ed607aa289c959..40c5a20c6c7093 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt @@ -300,7 +300,13 @@ public class ReactModalHostView(context: ThemedReactContext) : * changed. This has the pleasant side-effect of us not having to preface all Modals with "top: * statusBarHeight", since that margin will be included in the FrameLayout. */ - get() = FrameLayout(context).apply { addView(dialogRootViewGroup) } + get() = + FrameLayout(context).apply { + addView(dialogRootViewGroup) + if (!statusBarTranslucent) { + this.fitsSystemWindows = true + } + } /** * updateProperties will update the properties that do not require us to recreate the dialog