@@ -5,7 +5,38 @@ import com.facebook.react.ReactActivityDelegate
55import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
66import com.facebook.react.defaults.DefaultReactActivityDelegate
77
8+ import android.os.Bundle
9+ import android.os.Build
10+ import android.view.View
11+ import androidx.core.view.ViewCompat
12+ import androidx.core.view.WindowInsetsCompat
13+ import androidx.core.view.updatePadding
14+
815class MainActivity : ReactActivity () {
16+
17+ override fun onCreate (savedInstanceState : Bundle ? ) {
18+ super .onCreate(null )
19+
20+ if (Build .VERSION .SDK_INT >= 35 ) {
21+ val rootView = findViewById<View >(android.R .id.content)
22+
23+
24+ ViewCompat .setOnApplyWindowInsetsListener(rootView) { view, insets ->
25+ val bars = insets.getInsets(
26+ WindowInsetsCompat .Type .systemBars()
27+ or WindowInsetsCompat .Type .displayCutout()
28+ or WindowInsetsCompat .Type .ime() // adding the ime's height
29+ )
30+ rootView.updatePadding(
31+ left = bars.left,
32+ top = bars.top,
33+ right = bars.right,
34+ bottom = bars.bottom
35+ )
36+ WindowInsetsCompat .CONSUMED
37+ }
38+ }
39+ }
940 /* *
1041 * Returns the name of the main component registered from JavaScript. This is used to schedule
1142 * rendering of the component.
@@ -18,4 +49,4 @@ class MainActivity : ReactActivity() {
1849 */
1950 override fun createReactActivityDelegate (): ReactActivityDelegate =
2051 DefaultReactActivityDelegate (this , mainComponentName, fabricEnabled)
21- }
52+ }
0 commit comments