From 063ae7d3e8161fda8ed88f433296bba35115b73a Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Thu, 2 May 2024 12:46:05 -0700 Subject: [PATCH] Add native view config for inset props Summary: The insets props were introduced in this diff: D42193661 Changelog: [Internal] Reviewed By: javache Differential Revision: D56849870 fbshipit-source-id: 7be2a5825086ac954fdb8bc3bb86b57a2fa6d326 --- .../react-native/React/Views/RCTViewManager.m | 49 +++++++++++++++++++ .../ReactAndroid/api/ReactAndroid.api | 3 ++ .../react/uimanager/LayoutShadowNode.java | 25 ++++++++++ 3 files changed, 77 insertions(+) diff --git a/packages/react-native/React/Views/RCTViewManager.m b/packages/react-native/React/Views/RCTViewManager.m index 2e20ec99445..2409b105054 100644 --- a/packages/react-native/React/Views/RCTViewManager.m +++ b/packages/react-native/React/Views/RCTViewManager.m @@ -482,6 +482,55 @@ RCT_EXPORT_SHADOW_PROPERTY(borderStartWidth, float) RCT_EXPORT_SHADOW_PROPERTY(borderEndWidth, float) RCT_EXPORT_SHADOW_PROPERTY(borderWidth, float) +RCT_CUSTOM_SHADOW_PROPERTY(inset, YGValue, RCTView) +{ + // Property is only to be used in the new renderer. + // It is necessary to add it here, otherwise it gets + // filtered by view configs. +} + +RCT_CUSTOM_SHADOW_PROPERTY(insetBlock, YGValue, RCTView) +{ + // Property is only to be used in the new renderer. + // It is necessary to add it here, otherwise it gets + // filtered by view configs. +} + +RCT_CUSTOM_SHADOW_PROPERTY(insetBlockStart, YGValue, RCTView) +{ + // Property is only to be used in the new renderer. + // It is necessary to add it here, otherwise it gets + // filtered by view configs. +} + +RCT_CUSTOM_SHADOW_PROPERTY(insetBlockEnd, YGValue, RCTView) +{ + // Property is only to be used in the new renderer. + // It is necessary to add it here, otherwise it gets + // filtered by view configs. +} + +RCT_CUSTOM_SHADOW_PROPERTY(insetInline, YGValue, RCTView) +{ + // Property is only to be used in the new renderer. + // It is necessary to add it here, otherwise it gets + // filtered by view configs. +} + +RCT_CUSTOM_SHADOW_PROPERTY(insetInlineStart, YGValue, RCTView) +{ + // Property is only to be used in the new renderer. + // It is necessary to add it here, otherwise it gets + // filtered by view configs. +} + +RCT_CUSTOM_SHADOW_PROPERTY(insetInlineEnd, YGValue, RCTView) +{ + // Property is only to be used in the new renderer. + // It is necessary to add it here, otherwise it gets + // filtered by view configs. +} + RCT_EXPORT_SHADOW_PROPERTY(marginTop, YGValue) RCT_EXPORT_SHADOW_PROPERTY(marginRight, YGValue) RCT_EXPORT_SHADOW_PROPERTY(marginBottom, YGValue) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 3d1f681aa31..cac35c4f803 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4145,6 +4145,9 @@ public class com/facebook/react/uimanager/LayoutShadowNode : com/facebook/react/ public fun setFlexWrap (Ljava/lang/String;)V public fun setGap (Lcom/facebook/react/bridge/Dynamic;)V public fun setHeight (Lcom/facebook/react/bridge/Dynamic;)V + public fun setInset (Lcom/facebook/react/bridge/Dynamic;)V + public fun setInsetBlock (ILcom/facebook/react/bridge/Dynamic;)V + public fun setInsetInline (ILcom/facebook/react/bridge/Dynamic;)V public fun setJustifyContent (Ljava/lang/String;)V public fun setLayoutConformance (Ljava/lang/String;)V public fun setMargins (ILcom/facebook/react/bridge/Dynamic;)V diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java index 531154ceded..d627a07dbb2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java @@ -717,6 +717,31 @@ public class LayoutShadowNode extends ReactShadowNodeImpl { } } + @ReactPropGroup( + names = { + "insetBlock", + "insetBlockEnd", + "insetBlockStart", + }) + public void setInsetBlock(int index, Dynamic inset) { + // Do Nothing: Align with static ViewConfigs + } + + @ReactPropGroup( + names = { + "insetInline", + "insetInlineEnd", + "insetInlineStart", + }) + public void setInsetInline(int index, Dynamic inset) { + // Do Nothing: Align with static ViewConfigs + } + + @ReactProp(name = "inset") + public void setInset(Dynamic inset) { + // Do Nothing: Align with static ViewConfigs + } + @ReactPropGroup( names = { ViewProps.MARGIN,