Skip to content

Commit

Permalink
fix(android): improve edge-to-edge implementation using ActivityKTX (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
a-ghorbani authored Feb 23, 2025
1 parent a0b1c8b commit 8aade2e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ dependencies {
implementation platform('com.google.firebase:firebase-bom:32.7.0')
implementation 'com.google.firebase:firebase-appcheck-playintegrity'
implementation 'com.google.firebase:firebase-appcheck-debug'

// for edge-to-edge display
implementation "androidx.activity:activity-ktx:1.9.3"
}

// apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Expand Down
5 changes: 1 addition & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:screenOrientation="portrait"
android:fitsSystemWindows="false"
android:theme="@style/AppTheme">
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
12 changes: 5 additions & 7 deletions android/app/src/main/java/com/pocketpalai/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import android.os.Bundle // Required for onCreate parameter


class MainActivity : ReactActivity() {

Expand All @@ -22,11 +24,7 @@ class MainActivity : ReactActivity() {
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// Enable edge-to-edge display
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
window.setDecorFitsSystemWindows(false)
}
enableEdgeToEdge()
super.onCreate(savedInstanceState)
}
}
3 changes: 0 additions & 3 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>

</resources>

0 comments on commit 8aade2e

Please sign in to comment.