diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/NativeSafeAreaContextSpec.java b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/NativeSafeAreaContextSpec.java
index ebc40ca5dffde7..2062acb7db9329 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/NativeSafeAreaContextSpec.java
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/NativeSafeAreaContextSpec.java
@@ -1,21 +1,18 @@
-
/**
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ * This code was generated by
+ * [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
- * Do not edit this file as changes may cause incorrect behavior and will be lost
- * once the code is regenerated.
+ *
Do not edit this file as changes may cause incorrect behavior and will be lost once the code
+ * is regenerated.
*
* @generated by codegen project: GenerateModuleJavaSpec.js
- *
* @nolint
*/
-
package versioned.host.exp.exponent.modules.api.safeareacontext;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
-import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReactModuleWithSpec;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
@@ -25,7 +22,8 @@
import java.util.Set;
import javax.annotation.Nullable;
-public abstract class NativeSafeAreaContextSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
+public abstract class NativeSafeAreaContextSpec extends ReactContextBaseJavaModule
+ implements ReactModuleWithSpec, TurboModule {
public NativeSafeAreaContextSpec(ReactApplicationContext reactContext) {
super(reactContext);
}
@@ -38,19 +36,19 @@ public NativeSafeAreaContextSpec(ReactApplicationContext reactContext) {
Map constants = getTypedExportedConstants();
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
Set obligatoryFlowConstants = new HashSet<>();
- Set optionalFlowConstants = new HashSet<>(Arrays.asList(
- "initialWindowMetrics"
- ));
+ Set optionalFlowConstants = new HashSet<>(Arrays.asList("initialWindowMetrics"));
Set undeclaredConstants = new HashSet<>(constants.keySet());
undeclaredConstants.removeAll(obligatoryFlowConstants);
undeclaredConstants.removeAll(optionalFlowConstants);
if (!undeclaredConstants.isEmpty()) {
- throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
+ throw new IllegalStateException(
+ String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
}
undeclaredConstants = obligatoryFlowConstants;
undeclaredConstants.removeAll(constants.keySet());
if (!undeclaredConstants.isEmpty()) {
- throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
+ throw new IllegalStateException(
+ String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
}
}
return constants;
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerDelegate.java b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerDelegate.java
index a2f1636dce145f..50132a86e9871b 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerDelegate.java
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerDelegate.java
@@ -1,12 +1,12 @@
/**
-* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
-*
-* Do not edit this file as changes may cause incorrect behavior and will be lost
-* once the code is regenerated.
-*
-* @generated by codegen project: GeneratePropsJavaDelegate.js
-*/
-
+ * This code was generated by
+ * [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ *
+ * Do not edit this file as changes may cause incorrect behavior and will be lost once the code
+ * is regenerated.
+ *
+ * @generated by codegen project: GeneratePropsJavaDelegate.js
+ */
package versioned.host.exp.exponent.modules.api.safeareacontext;
import android.view.View;
@@ -14,10 +14,14 @@
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
-public class RNCSafeAreaProviderManagerDelegate & RNCSafeAreaProviderManagerInterface> extends BaseViewManagerDelegate {
+public class RNCSafeAreaProviderManagerDelegate<
+ T extends View,
+ U extends BaseViewManagerInterface & RNCSafeAreaProviderManagerInterface>
+ extends BaseViewManagerDelegate {
public RNCSafeAreaProviderManagerDelegate(U viewManager) {
super(viewManager);
}
+
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
super.setProperty(view, propName, value);
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerInterface.java b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerInterface.java
index c0a6d863b85b7c..e00d1a393b5747 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerInterface.java
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaProviderManagerInterface.java
@@ -1,12 +1,12 @@
/**
-* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
-*
-* Do not edit this file as changes may cause incorrect behavior and will be lost
-* once the code is regenerated.
-*
-* @generated by codegen project: GeneratePropsJavaInterface.js
-*/
-
+ * This code was generated by
+ * [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ *
+ * Do not edit this file as changes may cause incorrect behavior and will be lost once the code
+ * is regenerated.
+ *
+ * @generated by codegen project: GeneratePropsJavaInterface.js
+ */
package versioned.host.exp.exponent.modules.api.safeareacontext;
import android.view.View;
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerDelegate.java b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerDelegate.java
index e0c0f4dbae5592..1d551b756ca2f4 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerDelegate.java
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerDelegate.java
@@ -1,24 +1,27 @@
/**
-* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
-*
-* Do not edit this file as changes may cause incorrect behavior and will be lost
-* once the code is regenerated.
-*
-* @generated by codegen project: GeneratePropsJavaDelegate.js
-*/
-
+ * This code was generated by
+ * [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ *
+ *
Do not edit this file as changes may cause incorrect behavior and will be lost once the code
+ * is regenerated.
+ *
+ * @generated by codegen project: GeneratePropsJavaDelegate.js
+ */
package versioned.host.exp.exponent.modules.api.safeareacontext;
import android.view.View;
import androidx.annotation.Nullable;
-import com.facebook.react.bridge.ReadableArray;
+import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
-public class RNCSafeAreaViewManagerDelegate & RNCSafeAreaViewManagerInterface> extends BaseViewManagerDelegate {
+public class RNCSafeAreaViewManagerDelegate<
+ T extends View, U extends BaseViewManagerInterface & RNCSafeAreaViewManagerInterface>
+ extends BaseViewManagerDelegate {
public RNCSafeAreaViewManagerDelegate(U viewManager) {
super(viewManager);
}
+
@Override
public void setProperty(T view, String propName, @Nullable Object value) {
switch (propName) {
@@ -26,7 +29,7 @@ public void setProperty(T view, String propName, @Nullable Object value) {
mViewManager.setMode(view, (String) value);
break;
case "edges":
- mViewManager.setEdges(view, (ReadableArray) value);
+ mViewManager.setEdges(view, (ReadableMap) value);
break;
default:
super.setProperty(view, propName, value);
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerInterface.java b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerInterface.java
index 970a81b8f4c522..83106aadd3f91c 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerInterface.java
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/RNCSafeAreaViewManagerInterface.java
@@ -1,19 +1,20 @@
/**
-* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
-*
-* Do not edit this file as changes may cause incorrect behavior and will be lost
-* once the code is regenerated.
-*
-* @generated by codegen project: GeneratePropsJavaInterface.js
-*/
-
+ * This code was generated by
+ * [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ *
+ * Do not edit this file as changes may cause incorrect behavior and will be lost once the code
+ * is regenerated.
+ *
+ * @generated by codegen project: GeneratePropsJavaInterface.js
+ */
package versioned.host.exp.exponent.modules.api.safeareacontext;
import android.view.View;
import androidx.annotation.Nullable;
-import com.facebook.react.bridge.ReadableArray;
+import com.facebook.react.bridge.ReadableMap;
public interface RNCSafeAreaViewManagerInterface {
void setMode(T view, @Nullable String value);
- void setEdges(T view, @Nullable ReadableArray value);
+
+ void setEdges(T view, @Nullable ReadableMap value);
}
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaView.kt b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaView.kt
index bbc105f1d94b1e..e346ad7eca2ded 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaView.kt
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaView.kt
@@ -19,7 +19,7 @@ class SafeAreaView(context: Context?) :
ReactViewGroup(context), ViewTreeObserver.OnPreDrawListener, HasFabricViewStateManager {
private var mMode = SafeAreaViewMode.PADDING
private var mInsets: EdgeInsets? = null
- private var mEdges: EnumSet? = null
+ private var mEdges: SafeAreaViewEdges? = null
private var mProviderView: View? = null
private val mFabricViewStateManager = FabricViewStateManager()
@@ -30,7 +30,13 @@ class SafeAreaView(context: Context?) :
private fun updateInsets() {
val insets = mInsets
if (insets != null) {
- val edges = mEdges ?: EnumSet.allOf(SafeAreaViewEdges::class.java)
+ val edges =
+ mEdges
+ ?: SafeAreaViewEdges(
+ SafeAreaViewEdgeModes.ADDITIVE,
+ SafeAreaViewEdgeModes.ADDITIVE,
+ SafeAreaViewEdgeModes.ADDITIVE,
+ SafeAreaViewEdgeModes.ADDITIVE)
if (mFabricViewStateManager.hasStateWrapper()) {
mFabricViewStateManager.setState {
val map = Arguments.createMap()
@@ -43,8 +49,10 @@ class SafeAreaView(context: Context?) :
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
if (uiManager != null) {
uiManager.setViewLocalData(id, localData)
- // Sadly there doesn't seem to be a way to properly dirty a yoga node from java, so if we are in
- // the middle of a layout, we need to recompute it. There is also no way to know whether we
+ // Sadly there doesn't seem to be a way to properly dirty a yoga node from java, so if we
+ // are in
+ // the middle of a layout, we need to recompute it. There is also no way to know whether
+ // we
// are in the middle of a layout so always do it.
reactContext.runOnNativeModulesQueueThread {
uiManager.uiImplementation.dispatchViewUpdates(-1)
@@ -96,7 +104,7 @@ class SafeAreaView(context: Context?) :
updateInsets()
}
- fun setEdges(edges: EnumSet?) {
+ fun setEdges(edges: SafeAreaViewEdges) {
mEdges = edges
updateInsets()
}
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewEdges.kt b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewEdges.kt
index 5d65698badc7dd..e8e19f7ebefb2d 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewEdges.kt
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewEdges.kt
@@ -1,8 +1,18 @@
package versioned.host.exp.exponent.modules.api.safeareacontext
-enum class SafeAreaViewEdges {
- TOP,
- RIGHT,
- BOTTOM,
- LEFT
+import java.util.*
+
+enum class SafeAreaViewEdgeModes {
+ OFF,
+ ADDITIVE,
+ MAXIMUM
}
+
+data class SafeAreaViewEdges(
+ val top: SafeAreaViewEdgeModes,
+ val right: SafeAreaViewEdgeModes,
+ val bottom: SafeAreaViewEdgeModes,
+ val left: SafeAreaViewEdgeModes
+)
+
+class Safe
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewLocalData.kt b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewLocalData.kt
index 5df0bac9292107..e91f9f3eceab9c 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewLocalData.kt
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewLocalData.kt
@@ -5,5 +5,5 @@ import java.util.*
data class SafeAreaViewLocalData(
val insets: EdgeInsets,
val mode: SafeAreaViewMode,
- val edges: EnumSet
+ val edges: SafeAreaViewEdges,
)
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewManager.kt b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewManager.kt
index 8fdc26c694f21f..5cff5123fe3425 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewManager.kt
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewManager.kt
@@ -1,6 +1,6 @@
package versioned.host.exp.exponent.modules.api.safeareacontext
-import com.facebook.react.bridge.ReadableArray
+import com.facebook.react.bridge.ReadableMap
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.ReactStylesDiffMap
import com.facebook.react.uimanager.StateWrapper
@@ -39,26 +39,23 @@ class SafeAreaViewManager : ReactViewManager(), RNCSafeAreaViewManagerInterface<
}
@ReactProp(name = "edges")
- override fun setEdges(view: SafeAreaView, propList: ReadableArray?) {
- val edges = EnumSet.noneOf(SafeAreaViewEdges::class.java)
+ override fun setEdges(view: SafeAreaView, propList: ReadableMap?) {
if (propList != null) {
- for (i in 0 until propList.size()) {
- when (propList.getString(i)) {
- "top" -> {
- edges.add(SafeAreaViewEdges.TOP)
- }
- "right" -> {
- edges.add(SafeAreaViewEdges.RIGHT)
- }
- "bottom" -> {
- edges.add(SafeAreaViewEdges.BOTTOM)
- }
- "left" -> {
- edges.add(SafeAreaViewEdges.LEFT)
- }
- }
- }
- view.setEdges(edges)
+ view.setEdges(
+ SafeAreaViewEdges(
+ top = propList.getString("top")?.let { SafeAreaViewEdgeModes.valueOf(it.uppercase()) }
+ ?: SafeAreaViewEdgeModes.OFF,
+ right =
+ propList.getString("right")?.let { SafeAreaViewEdgeModes.valueOf(it.uppercase()) }
+ ?: SafeAreaViewEdgeModes.OFF,
+ bottom =
+ propList.getString("bottom")?.let {
+ SafeAreaViewEdgeModes.valueOf(it.uppercase())
+ }
+ ?: SafeAreaViewEdgeModes.OFF,
+ left =
+ propList.getString("left")?.let { SafeAreaViewEdgeModes.valueOf(it.uppercase()) }
+ ?: SafeAreaViewEdgeModes.OFF))
}
}
diff --git a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewShadowNode.kt b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewShadowNode.kt
index d17089fe87acbb..e7b08534c29cc5 100644
--- a/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewShadowNode.kt
+++ b/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/safeareacontext/SafeAreaViewShadowNode.kt
@@ -4,7 +4,7 @@ import com.facebook.react.bridge.Dynamic
import com.facebook.react.bridge.ReadableType
import com.facebook.react.uimanager.*
import com.facebook.react.uimanager.annotations.ReactPropGroup
-import com.facebook.yoga.YogaNode
+import kotlin.math.max
class SafeAreaViewShadowNode : LayoutShadowNode() {
private var mLocalData: SafeAreaViewLocalData? = null
@@ -65,20 +65,30 @@ class SafeAreaViewShadowNode : LayoutShadowNode() {
left = PixelUtil.toPixelFromDIP(left)
val edges = localData.edges
val insets = localData.insets
- val insetTop: Float = if (edges.contains(SafeAreaViewEdges.TOP)) insets.top else 0.0f
- val insetRight: Float = if (edges.contains(SafeAreaViewEdges.RIGHT)) insets.right else 0.0f
- val insetBottom: Float = if (edges.contains(SafeAreaViewEdges.BOTTOM)) insets.bottom else 0.0f
- val insetLeft: Float = if (edges.contains(SafeAreaViewEdges.LEFT)) insets.left else 0.0f
if (localData.mode == SafeAreaViewMode.PADDING) {
- super.setPadding(Spacing.TOP, insetTop + top)
- super.setPadding(Spacing.RIGHT, insetRight + right)
- super.setPadding(Spacing.BOTTOM, insetBottom + bottom)
- super.setPadding(Spacing.LEFT, insetLeft + left)
+ super.setPadding(Spacing.TOP, getEdgeValue(edges.top, insets.top, top))
+ super.setPadding(Spacing.RIGHT, getEdgeValue(edges.right, insets.right, right))
+ super.setPadding(Spacing.BOTTOM, getEdgeValue(edges.bottom, insets.bottom, bottom))
+ super.setPadding(Spacing.LEFT, getEdgeValue(edges.left, insets.left, left))
} else {
- super.setMargin(Spacing.TOP, insetTop + top)
- super.setMargin(Spacing.RIGHT, insetRight + right)
- super.setMargin(Spacing.BOTTOM, insetBottom + bottom)
- super.setMargin(Spacing.LEFT, insetLeft + left)
+ super.setMargin(Spacing.TOP, getEdgeValue(edges.top, insets.top, top))
+ super.setMargin(Spacing.RIGHT, getEdgeValue(edges.right, insets.right, right))
+ super.setMargin(Spacing.BOTTOM, getEdgeValue(edges.bottom, insets.bottom, bottom))
+ super.setMargin(Spacing.LEFT, getEdgeValue(edges.left, insets.left, left))
+ }
+ }
+
+ private fun getEdgeValue(
+ edgeMode: SafeAreaViewEdgeModes,
+ insetValue: Float,
+ edgeValue: Float
+ ): Float {
+ if (edgeMode == SafeAreaViewEdgeModes.OFF) {
+ return edgeValue
+ } else if (edgeMode == SafeAreaViewEdgeModes.MAXIMUM) {
+ return max(insetValue, edgeValue)
+ } else {
+ return insetValue + edgeValue
}
}
diff --git a/apps/bare-expo/ios/Podfile.lock b/apps/bare-expo/ios/Podfile.lock
index a82d768b79b5e6..e819e39f04b5ce 100644
--- a/apps/bare-expo/ios/Podfile.lock
+++ b/apps/bare-expo/ios/Podfile.lock
@@ -676,7 +676,7 @@ PODS:
- React-Core
- react-native-pager-view (6.2.0):
- React-Core
- - react-native-safe-area-context (4.5.3):
+ - react-native-safe-area-context (4.6.3):
- RCT-Folly
- RCTRequired
- RCTTypeSafety
@@ -1479,7 +1479,7 @@ SPEC CHECKSUMS:
React-logger: 454ffb01980778a43b0153ee98721d0275b56616
react-native-netinfo: ccbe1085dffd16592791d550189772e13bf479e2
react-native-pager-view: 0ccb8bf60e2ebd38b1f3669fa3650ecce81db2df
- react-native-safe-area-context: b8979f5eda6ed5903d4dbc885be3846ea3daa753
+ react-native-safe-area-context: 36cc67648134e89465663b8172336a19eeda493d
react-native-segmented-control: 0e4b5d93911e2234f110057df2b41738b326ab3e
react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d
react-native-view-shot: 705f999ac2a24e4e6c909c0ca65c732ed33ca2ff
diff --git a/apps/bare-expo/package.json b/apps/bare-expo/package.json
index 3b98fb244ccc4c..daf5258e4d5fba 100644
--- a/apps/bare-expo/package.json
+++ b/apps/bare-expo/package.json
@@ -84,7 +84,7 @@
"react-native-gesture-handler": "~2.12.0",
"react-native-pager-view": "6.2.0",
"react-native-reanimated": "~3.3.0",
- "react-native-safe-area-context": "4.5.3",
+ "react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.20.0",
"react-native-shared-element": "0.8.8",
"react-native-svg": "13.9.0",
diff --git a/apps/native-component-list/package.json b/apps/native-component-list/package.json
index 95d546ff0577df..804214b27e9c1f 100644
--- a/apps/native-component-list/package.json
+++ b/apps/native-component-list/package.json
@@ -148,7 +148,7 @@
"react-native-pager-view": "6.2.0",
"react-native-paper": "^4.0.1",
"react-native-reanimated": "~3.3.0",
- "react-native-safe-area-context": "4.5.3",
+ "react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.20.0",
"react-native-shared-element": "0.8.8",
"react-native-svg": "13.9.0",
diff --git a/home/package.json b/home/package.json
index c2f3d78fad54c6..7054d598c7ece0 100644
--- a/home/package.json
+++ b/home/package.json
@@ -64,7 +64,7 @@
"react-native-maps": "1.7.1",
"react-native-paper": "^4.0.1",
"react-native-reanimated": "~3.3.0",
- "react-native-safe-area-context": "4.5.3",
+ "react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.20.0",
"react-redux": "^7.2.0",
"react-string-replace": "^0.4.4",
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index a165a4816a06af..0d9bb7a25d83b2 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -2081,7 +2081,7 @@ PODS:
- React-Core
- react-native-pager-view (6.2.0):
- React-Core
- - react-native-safe-area-context (4.5.3):
+ - react-native-safe-area-context (4.6.3):
- RCT-Folly
- RCTRequired
- RCTTypeSafety
@@ -3761,7 +3761,7 @@ SPEC CHECKSUMS:
React-logger: 454ffb01980778a43b0153ee98721d0275b56616
react-native-netinfo: ccbe1085dffd16592791d550189772e13bf479e2
react-native-pager-view: 0ccb8bf60e2ebd38b1f3669fa3650ecce81db2df
- react-native-safe-area-context: b8979f5eda6ed5903d4dbc885be3846ea3daa753
+ react-native-safe-area-context: 36cc67648134e89465663b8172336a19eeda493d
react-native-segmented-control: 0e4b5d93911e2234f110057df2b41738b326ab3e
react-native-skia: d770660c767ab137636bd30bf18a1b70a18055c8
react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d
diff --git a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaShadowView.m b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaShadowView.m
index 1597bc851d203d..25c326b7e4fadd 100644
--- a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaShadowView.m
+++ b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaShadowView.m
@@ -3,6 +3,7 @@
#import
#include
+#import "RNCSafeAreaViewEdgeMode.h"
#import "RNCSafeAreaViewEdges.h"
#import "RNCSafeAreaViewLocalData.h"
#import "RNCSafeAreaViewMode.h"
@@ -109,23 +110,32 @@ - (void)updateInsets
CGFloat bottom = 0;
CGFloat left = 0;
- CGFloat insetTop = (edges & RNCSafeAreaViewEdgesTop) ? insets.top : 0;
- CGFloat insetRight = (edges & RNCSafeAreaViewEdgesRight) ? insets.right : 0;
- CGFloat insetBottom = (edges & RNCSafeAreaViewEdgesBottom) ? insets.bottom : 0;
- CGFloat insetLeft = (edges & RNCSafeAreaViewEdgesLeft) ? insets.left : 0;
-
if (mode == RNCSafeAreaViewModePadding) {
[self extractEdges:_paddingMetaProps top:&top right:&right bottom:&bottom left:&left];
- super.paddingTop = (YGValue){insetTop + top, YGUnitPoint};
- super.paddingRight = (YGValue){insetRight + right, YGUnitPoint};
- super.paddingBottom = (YGValue){insetBottom + bottom, YGUnitPoint};
- super.paddingLeft = (YGValue){insetLeft + left, YGUnitPoint};
+ super.paddingTop = (YGValue){[self getEdgeValue:edges.top insetValue:insets.top edgeValue:top], YGUnitPoint};
+ super.paddingRight =
+ (YGValue){[self getEdgeValue:edges.right insetValue:insets.right edgeValue:right], YGUnitPoint};
+ super.paddingBottom =
+ (YGValue){[self getEdgeValue:edges.bottom insetValue:insets.bottom edgeValue:bottom], YGUnitPoint};
+ super.paddingLeft = (YGValue){[self getEdgeValue:edges.left insetValue:insets.left edgeValue:left], YGUnitPoint};
} else if (mode == RNCSafeAreaViewModeMargin) {
[self extractEdges:_marginMetaProps top:&top right:&right bottom:&bottom left:&left];
- super.marginTop = (YGValue){insetTop + top, YGUnitPoint};
- super.marginRight = (YGValue){insetRight + right, YGUnitPoint};
- super.marginBottom = (YGValue){insetBottom + bottom, YGUnitPoint};
- super.marginLeft = (YGValue){insetLeft + left, YGUnitPoint};
+ super.marginTop = (YGValue){[self getEdgeValue:edges.top insetValue:insets.top edgeValue:top], YGUnitPoint};
+ super.marginRight = (YGValue){[self getEdgeValue:edges.right insetValue:insets.right edgeValue:right], YGUnitPoint};
+ super.marginBottom =
+ (YGValue){[self getEdgeValue:edges.bottom insetValue:insets.bottom edgeValue:bottom], YGUnitPoint};
+ super.marginLeft = (YGValue){[self getEdgeValue:edges.left insetValue:insets.left edgeValue:left], YGUnitPoint};
+ }
+}
+
+- (CGFloat)getEdgeValue:(RNCSafeAreaViewEdgeMode)edgeMode insetValue:(CGFloat)insetValue edgeValue:(CGFloat)edgeValue
+{
+ if (edgeMode == RNCSafeAreaViewEdgeModeOff) {
+ return edgeValue;
+ } else if (edgeMode == RNCSafeAreaViewEdgeModeMaximum) {
+ return MAX(insetValue, edgeValue);
+ } else {
+ return insetValue + edgeValue;
}
}
diff --git a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaView.m b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaView.m
index 071001f28f220f..834d8167bcbf1c 100644
--- a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaView.m
+++ b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaView.m
@@ -23,7 +23,8 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
_bridge = bridge;
// Defaults
_mode = RNCSafeAreaViewModePadding;
- _edges = RNCSafeAreaViewEdgesAll;
+ _edges = RNCSafeAreaViewEdgesMake(
+ RNCSafeAreaViewEdgeModeOff, RNCSafeAreaViewEdgeModeOff, RNCSafeAreaViewEdgeModeOff, RNCSafeAreaViewEdgeModeOff);
}
return self;
diff --git a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdgeMode.h b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdgeMode.h
new file mode 100644
index 00000000000000..406c719e734d2b
--- /dev/null
+++ b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdgeMode.h
@@ -0,0 +1,12 @@
+#import
+#import
+
+typedef NS_ENUM(NSInteger, RNCSafeAreaViewEdgeMode) {
+ RNCSafeAreaViewEdgeModeOff,
+ RNCSafeAreaViewEdgeModeAdditive,
+ RNCSafeAreaViewEdgeModeMaximum
+};
+
+@interface RCTConvert (RNCSafeAreaViewEdgeMode)
++ (RNCSafeAreaViewEdgeMode)RNCSafeAreaViewEdgeMode:(nullable id)json;
+@end
diff --git a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdgeMode.m b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdgeMode.m
new file mode 100644
index 00000000000000..a53056eb0a6d41
--- /dev/null
+++ b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdgeMode.m
@@ -0,0 +1,16 @@
+#import "RNCSafeAreaViewEdgeMode.h"
+#import
+
+@implementation RCTConvert (RNCSafeAreaViewEdgeMode)
+
+RCT_ENUM_CONVERTER(
+ RNCSafeAreaViewEdgeMode,
+ (@{
+ @"off" : @(RNCSafeAreaViewEdgeModeOff),
+ @"additive" : @(RNCSafeAreaViewEdgeModeAdditive),
+ @"maximum" : @(RNCSafeAreaViewEdgeModeMaximum),
+ }),
+ RNCSafeAreaViewEdgeModeOff,
+ integerValue);
+
+@end
diff --git a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.h b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.h
index 14126d6cdc6ac3..a2e15039a6f3e3 100644
--- a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.h
+++ b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.h
@@ -1,10 +1,15 @@
#import
+#import "RNCSafeAreaViewEdgeMode.h"
-typedef NS_ENUM(NSInteger, RNCSafeAreaViewEdges) {
- RNCSafeAreaViewEdgesTop = 0b1000,
- RNCSafeAreaViewEdgesRight = 0b0100,
- RNCSafeAreaViewEdgesBottom = 0b0010,
- RNCSafeAreaViewEdgesLeft = 0b0001,
- RNCSafeAreaViewEdgesAll = 0b1111,
- RNCSafeAreaViewEdgesNone = 0b0000,
-};
+typedef struct RNCSafeAreaViewEdges {
+ RNCSafeAreaViewEdgeMode top;
+ RNCSafeAreaViewEdgeMode right;
+ RNCSafeAreaViewEdgeMode bottom;
+ RNCSafeAreaViewEdgeMode left;
+} RNCSafeAreaViewEdges;
+
+RNCSafeAreaViewEdges RNCSafeAreaViewEdgesMake(
+ RNCSafeAreaViewEdgeMode top,
+ RNCSafeAreaViewEdgeMode right,
+ RNCSafeAreaViewEdgeMode bottom,
+ RNCSafeAreaViewEdgeMode left);
diff --git a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.m b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.m
index c5e0531639802b..aadb8259aff82c 100644
--- a/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.m
+++ b/ios/vendored/unversioned/react-native-safe-area-context/ios/RNCSafeAreaViewEdges.m
@@ -1,17 +1,36 @@
#import "RNCSafeAreaViewEdges.h"
#import
+#import "RNCSafeAreaViewEdgeMode.h"
-@implementation RCTConvert (RNCSafeAreaView)
+RNCSafeAreaViewEdges RNCSafeAreaViewEdgesMake(
+ RNCSafeAreaViewEdgeMode top,
+ RNCSafeAreaViewEdgeMode right,
+ RNCSafeAreaViewEdgeMode bottom,
+ RNCSafeAreaViewEdgeMode left)
+{
+ RNCSafeAreaViewEdges edges;
+ edges.top = top;
+ edges.left = left;
+ edges.bottom = bottom;
+ edges.right = right;
+ return edges;
+}
-RCT_MULTI_ENUM_CONVERTER(
+RNCSafeAreaViewEdges RNCSafeAreaViewEdgesMakeString(NSString *top, NSString *right, NSString *bottom, NSString *left)
+{
+ RNCSafeAreaViewEdges edges;
+ edges.top = [RCTConvert RNCSafeAreaViewEdgeMode:top];
+ edges.right = [RCTConvert RNCSafeAreaViewEdgeMode:right];
+ edges.bottom = [RCTConvert RNCSafeAreaViewEdgeMode:bottom];
+ edges.left = [RCTConvert RNCSafeAreaViewEdgeMode:left];
+ return edges;
+}
+
+@implementation RCTConvert (RNCSafeAreaViewEdges)
+
+RCT_CUSTOM_CONVERTER(
+ RNCSafeAreaViewEdges,
RNCSafeAreaViewEdges,
- (@{
- @"top" : @(RNCSafeAreaViewEdgesTop),
- @"right" : @(RNCSafeAreaViewEdgesRight),
- @"bottom" : @(RNCSafeAreaViewEdgesBottom),
- @"left" : @(RNCSafeAreaViewEdgesLeft),
- }),
- RNCSafeAreaViewEdgesNone,
- integerValue);
+ RNCSafeAreaViewEdgesMakeString(json[@"top"], json[@"right"], json[@"bottom"], json[@"left"]))
@end
diff --git a/ios/vendored/unversioned/react-native-safe-area-context/react-native-safe-area-context.podspec.json b/ios/vendored/unversioned/react-native-safe-area-context/react-native-safe-area-context.podspec.json
index 6ff83a02f87679..af6b4475a55827 100644
--- a/ios/vendored/unversioned/react-native-safe-area-context/react-native-safe-area-context.podspec.json
+++ b/ios/vendored/unversioned/react-native-safe-area-context/react-native-safe-area-context.podspec.json
@@ -1,6 +1,6 @@
{
"name": "react-native-safe-area-context",
- "version": "4.5.3",
+ "version": "4.6.3",
"summary": "A flexible way to handle safe area, also works on Android and web.",
"license": "MIT",
"authors": "Janic Duplessis ",
@@ -11,7 +11,7 @@
},
"source": {
"git": "https://github.com/th3rdwave/react-native-safe-area-context.git",
- "tag": "v4.5.3"
+ "tag": "v4.6.3"
},
"source_files": "ios/**/*.{h,m,mm}",
"exclude_files": "ios/Fabric",
diff --git a/packages/expo-stories/package.json b/packages/expo-stories/package.json
index 0abff321e75ad4..96a1972dcac687 100644
--- a/packages/expo-stories/package.json
+++ b/packages/expo-stories/package.json
@@ -31,7 +31,7 @@
"fs-extra": "^9.1.0",
"glob": "^7.1.7",
"react-native-gesture-handler": "~2.12.0",
- "react-native-safe-area-context": "4.5.3",
+ "react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.20.0",
"react-native-svg": "13.9.0",
"sane": "^5.0.1"
diff --git a/packages/expo/bundledNativeModules.json b/packages/expo/bundledNativeModules.json
index 610a875a2fee35..fb6227ef385ea7 100644
--- a/packages/expo/bundledNativeModules.json
+++ b/packages/expo/bundledNativeModules.json
@@ -91,7 +91,7 @@
"react-native-pager-view": "6.2.0",
"react-native-reanimated": "~3.3.0",
"react-native-screens": "~3.20.0",
- "react-native-safe-area-context": "4.5.3",
+ "react-native-safe-area-context": "4.6.3",
"react-native-shared-element": "0.8.8",
"react-native-svg": "13.9.0",
"react-native-view-shot": "3.6.0",
diff --git a/yarn.lock b/yarn.lock
index 1b97e016ae0f04..55d9b496ad3b4b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -15906,10 +15906,10 @@ react-native-reanimated@~3.3.0:
convert-source-map "^2.0.0"
invariant "^2.2.4"
-react-native-safe-area-context@4.5.3:
- version "4.5.3"
- resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.5.3.tgz#e98eb1a73a6b3846d296545fe74760754dbaaa69"
- integrity sha512-ihYeGDEBSkYH+1aWnadNhVtclhppVgd/c0tm4mj0+HV11FoiWJ8N6ocnnZnRLvM5Fxc+hUqxR9bm5AXU3rXiyA==
+react-native-safe-area-context@4.6.3:
+ version "4.6.3"
+ resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.6.3.tgz#f06cfea05b1c4b018aa9758667a109f619c62b55"
+ integrity sha512-3CeZM9HFXkuqiU9HqhOQp1yxhXw6q99axPWrT+VJkITd67gnPSU03+U27Xk2/cr9XrLUnakM07kj7H0hdPnFiQ==
react-native-safe-area-view@^0.14.9:
version "0.14.9"