Skip to content

Commit 0577b68

Browse files
authored
fix(Android, Examples): Fix crashes in examples below API level 29 (#3588)
## Description <img width="1121" height="175" alt="Screenshot 2026-01-29 at 15 41 29" src="https://github.com/user-attachments/assets/4d19fff5-ca98-40bf-b605-69aa1f9204d1" /> ## Changes - Wrapper problematic code with the API-level check ## Before & after - visual documentation ### Before Crash (on API level 28) ### After No crash (on API level 28) ## Test plan Launch both apps on device with API lvl < 29 ## Checklist - [x] Included code example that can be used to test this change. - [ ] Updated / created local changelog entries in relevant test files. - [ ] For visual changes, included screenshots / GIFs / recordings documenting the change. - [ ] For API changes, updated relevant public types. - [x] Ensured that CI passes
1 parent 1b84d3a commit 0577b68

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

  • Example/android/app/src/main/java/com/swmansion/rnscreens/example
  • FabricExample/android/app/src/main/java/com/fabricexample

Example/android/app/src/main/java/com/swmansion/rnscreens/example/MainActivity.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class MainActivity : ReactActivity() {
3030
override fun onAttachedToWindow() {
3131
super.onAttachedToWindow()
3232
// opt out of having 80% opacity over 3-button navigation
33-
getWindow().setNavigationBarContrastEnforced(false)
33+
// supported for API level 29 or higher
34+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
35+
getWindow().setNavigationBarContrastEnforced(false)
36+
}
3437
}
3538
}

FabricExample/android/app/src/main/java/com/fabricexample/MainActivity.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class MainActivity : ReactActivity() {
3030
override fun onAttachedToWindow() {
3131
super.onAttachedToWindow()
3232
// opt out of having 80% opacity over 3-button navigation
33-
getWindow().setNavigationBarContrastEnforced(false)
33+
// supported for API level 29 or higher
34+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
35+
getWindow().setNavigationBarContrastEnforced(false)
36+
}
3437
}
3538
}

0 commit comments

Comments
 (0)