Skip to content

Commit

Permalink
Add native view config for {margin,padding}{block,inline} props
Browse files Browse the repository at this point in the history
Summary:
The margin/padding props were introduced in this diff: D41267765

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56846578
  • Loading branch information
RSNara authored and facebook-github-bot committed May 2, 2024
1 parent 184ebad commit 1df2150
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
84 changes: 84 additions & 0 deletions packages/react-native/React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,48 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie
RCT_EXPORT_SHADOW_PROPERTY(marginHorizontal, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(margin, YGValue)

RCT_CUSTOM_SHADOW_PROPERTY(marginBlock, 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(marginBlockEnd, 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(marginBlockStart, 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(marginInline, 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(marginInlineEnd, 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(marginInlineStart, 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(paddingTop, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(paddingRight, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(paddingBottom, YGValue)
Expand All @@ -551,6 +593,48 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie
RCT_EXPORT_SHADOW_PROPERTY(paddingHorizontal, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(padding, YGValue)

RCT_CUSTOM_SHADOW_PROPERTY(paddingBlock, 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(paddingBlockEnd, 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(paddingBlockStart, 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(paddingInline, 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(paddingInlineEnd, 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(paddingInlineStart, 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(flex, float)
RCT_EXPORT_SHADOW_PROPERTY(flexGrow, float)
RCT_EXPORT_SHADOW_PROPERTY(flexShrink, float)
Expand Down
4 changes: 4 additions & 0 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -4150,12 +4150,16 @@ public class com/facebook/react/uimanager/LayoutShadowNode : com/facebook/react/
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 setMarginBlock (ILcom/facebook/react/bridge/Dynamic;)V
public fun setMarginInline (ILcom/facebook/react/bridge/Dynamic;)V
public fun setMargins (ILcom/facebook/react/bridge/Dynamic;)V
public fun setMaxHeight (Lcom/facebook/react/bridge/Dynamic;)V
public fun setMaxWidth (Lcom/facebook/react/bridge/Dynamic;)V
public fun setMinHeight (Lcom/facebook/react/bridge/Dynamic;)V
public fun setMinWidth (Lcom/facebook/react/bridge/Dynamic;)V
public fun setOverflow (Ljava/lang/String;)V
public fun setPaddingBlock (ILcom/facebook/react/bridge/Dynamic;)V
public fun setPaddingInline (ILcom/facebook/react/bridge/Dynamic;)V
public fun setPaddings (ILcom/facebook/react/bridge/Dynamic;)V
public fun setPosition (Ljava/lang/String;)V
public fun setPositionValues (ILcom/facebook/react/bridge/Dynamic;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,46 @@ public void setDisplay(@Nullable String display) {
}
}

@ReactPropGroup(
names = {
"marginBlock",
"marginBlockEnd",
"marginBlockStart",
})
public void setMarginBlock(int index, Dynamic margin) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"marginInline",
"marginInlineEnd",
"marginInlineStart",
})
public void setMarginInline(int index, Dynamic margin) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"paddingBlock",
"paddingBlockEnd",
"paddingBlockStart",
})
public void setPaddingBlock(int index, Dynamic padding) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"paddingInline",
"paddingInlineEnd",
"paddingInlineStart",
})
public void setPaddingInline(int index, Dynamic padding) {
// Do Nothing: Align with static ViewConfigs
}

@ReactPropGroup(
names = {
"insetBlock",
Expand Down

0 comments on commit 1df2150

Please sign in to comment.