Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ android {
} else {
srcDirs += "src/versioned/pointerevents/latest"
}

// Edge-to-edge detection
if (REACT_NATIVE_MINOR_VERSION <= 80) {
srcDirs += "src/versioned/edge-to-edge/80"
} else {
srcDirs += "src/versioned/edge-to-edge/latest"
}
}
res {
if (safeExtGet(['compileSdkVersion', 'compileSdk'], rnsDefaultCompileSdkVersion) >= 33) {
Expand Down
15 changes: 8 additions & 7 deletions android/src/main/java/com/swmansion/rnscreens/CustomToolbar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ open class CustomToolbar(
context: Context,
val config: ScreenStackHeaderConfig,
) : Toolbar(context) {
// Switch this flag to enable/disable display cutout avoidance.
// Currently this is controlled by isTopInsetEnabled prop.
private val shouldAvoidDisplayCutout
get() = config.isTopInsetEnabled

private val shouldApplyTopInset
get() = config.isTopInsetEnabled
// Due to edge-to-edge enforcement starting from Android SDK 35, isTopInsetEnabled prop has been
// removed. Previously, shouldAvoidDisplayCutout, shouldApplyTopInset would directly return the
// value of isTopInsetEnabled. Now, the values of shouldAvoidDisplayCutout, shouldApplyTopInse
// are hard-coded to true (which was the value used previously for isTopInsetEnabled when
// edge-to-edge was enabled: https://github.com/software-mansion/react-native-screens/pull/2464/files#diff-bd1164595b04f44490738b8183f84a625c0e7552a4ae70bfefcdf3bca4d37fc7R34).
private val shouldAvoidDisplayCutout = true

private val shouldApplyTopInset = true

private var lastInsets = InsetsCompat.NONE

Expand Down
76 changes: 0 additions & 76 deletions android/src/main/java/com/swmansion/rnscreens/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -369,78 +369,6 @@ class Screen(
fragmentWrapper?.let { ScreenWindowTraits.setHidden(this, it.tryGetActivity()) }
}

@Deprecated(
"For apps targeting SDK 35 or above this prop has no effect because " +
"edge-to-edge is enabled by default and the status bar is always translucent.",
)
var isStatusBarTranslucent: Boolean? = null
set(statusBarTranslucent) {
if (statusBarTranslucent != null) {
ScreenWindowTraits.applyDidSetStatusBarAppearance()
}
field = statusBarTranslucent
fragmentWrapper?.let {
ScreenWindowTraits.setTranslucent(
this,
it.tryGetActivity(),
it.tryGetContext(),
)
}
}

@Deprecated(
"For apps targeting SDK 35 or above this prop has no effect because " +
"edge-to-edge is enabled by default and the status bar is always translucent.",
)
var statusBarColor: Int? = null
set(statusBarColor) {
if (statusBarColor != null) {
ScreenWindowTraits.applyDidSetStatusBarAppearance()
}
field = statusBarColor
fragmentWrapper?.let {
ScreenWindowTraits.setColor(
this,
it.tryGetActivity(),
it.tryGetContext(),
)
}
}

@Deprecated(
"For all apps targeting Android SDK 35 or above edge-to-edge is enabled by default. ",
)
var navigationBarColor: Int? = null
set(navigationBarColor) {
if (navigationBarColor != null) {
ScreenWindowTraits.applyDidSetNavigationBarAppearance()
}
field = navigationBarColor
fragmentWrapper?.let {
ScreenWindowTraits.setNavigationBarColor(
this,
it.tryGetActivity(),
)
}
}

@Deprecated(
"For all apps targeting Android SDK 35 or above edge-to-edge is enabled by default. ",
)
var isNavigationBarTranslucent: Boolean? = null
set(navigationBarTranslucent) {
if (navigationBarTranslucent != null) {
ScreenWindowTraits.applyDidSetNavigationBarAppearance()
}
field = navigationBarTranslucent
fragmentWrapper?.let {
ScreenWindowTraits.setNavigationBarTranslucent(
this,
it.tryGetActivity(),
)
}
}

var isNavigationBarHidden: Boolean? = null
set(navigationBarHidden) {
if (navigationBarHidden != null) {
Expand Down Expand Up @@ -633,13 +561,9 @@ class Screen(

enum class WindowTraits {
ORIENTATION,
COLOR,
STYLE,
TRANSLUCENT,
HIDDEN,
ANIMATED,
NAVIGATION_BAR_COLOR,
NAVIGATION_BAR_TRANSLUCENT,
NAVIGATION_BAR_HIDDEN,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ class ScreenStackHeaderConfig(
private var isShadowHidden = false
private var isDestroyed = false
private var backButtonInCustomView = false
var isTopInsetEnabled = true
private set

private var tintColor = 0
private var isAttachedToWindow = false
private val defaultStartInset: Int
Expand Down Expand Up @@ -394,10 +391,6 @@ class ScreenStackHeaderConfig(
tintColor = color
}

fun setTopInsetEnabled(topInsetEnabled: Boolean) {
isTopInsetEnabled = topInsetEnabled
}

fun setBackgroundColor(color: Int?) {
backgroundColor = color
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,12 @@ class ScreenStackHeaderConfigViewManager :
config.setHideBackButton(hideBackButton)
}

@Deprecated("For apps targeting SDK 35 or above edge-to-edge is enabled by default.")
@ReactProp(name = "topInsetEnabled")
override fun setTopInsetEnabled(
config: ScreenStackHeaderConfig,
topInsetEnabled: Boolean,
) {
config.setTopInsetEnabled(topInsetEnabled)
logNotAvailable("topInsetEnabled")
}

@ReactProp(name = "color", customType = "Color")
Expand Down
20 changes: 9 additions & 11 deletions android/src/main/java/com/swmansion/rnscreens/ScreenViewManager.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.swmansion.rnscreens

import android.util.Log
import android.view.View
import com.facebook.react.bridge.JSApplicationIllegalArgumentException
import com.facebook.react.bridge.ReadableArray
Expand Down Expand Up @@ -97,6 +98,10 @@ open class ScreenViewManager :
view.onFinalizePropsUpdate()
}

private fun logNotAvailable(propName: String) {
Log.w("[RNScreens]", "$propName prop is not available on Android")
}

@ReactProp(name = "activityState")
fun setActivityState(
view: Screen,
Expand Down Expand Up @@ -191,16 +196,12 @@ open class ScreenViewManager :
view.isStatusBarAnimated = animated
}

@Deprecated(
"For apps targeting SDK 35 or above this prop has no effect. " +
"Since the edge-to-edge is enabled by default the color is always translucent.",
)
@ReactProp(name = "statusBarColor", customType = "Color")
override fun setStatusBarColor(
view: Screen,
statusBarColor: Int?,
) {
view.statusBarColor = statusBarColor
logNotAvailable("statusBarColor")
}

@ReactProp(name = "statusBarStyle")
Expand All @@ -211,13 +212,12 @@ open class ScreenViewManager :
view.statusBarStyle = statusBarStyle
}

@Deprecated("For apps targeting SDK 35 or above edge-to-edge is enabled by default and will be enforced in the future.")
@ReactProp(name = "statusBarTranslucent")
override fun setStatusBarTranslucent(
view: Screen,
statusBarTranslucent: Boolean,
) {
view.isStatusBarTranslucent = statusBarTranslucent
logNotAvailable("statusBarTranslucent")
}

@ReactProp(name = "statusBarHidden")
Expand All @@ -228,22 +228,20 @@ open class ScreenViewManager :
view.isStatusBarHidden = statusBarHidden
}

@Deprecated("For apps targeting SDK 35 or above this prop has no effect")
@ReactProp(name = "navigationBarColor", customType = "Color")
override fun setNavigationBarColor(
view: Screen,
navigationBarColor: Int?,
) {
view.navigationBarColor = navigationBarColor
logNotAvailable("navigationBarColor")
}

@Deprecated("For apps targeting SDK 35 or above edge-to-edge is enabled by default")
@ReactProp(name = "navigationBarTranslucent")
override fun setNavigationBarTranslucent(
view: Screen,
navigationBarTranslucent: Boolean,
) {
view.isNavigationBarTranslucent = navigationBarTranslucent
logNotAvailable("navigationBarTranslucent")
}

@ReactProp(name = "navigationBarHidden")
Expand Down
Loading
Loading