Skip to content

Commit

Permalink
feat: Add iOS Paper implementation of inset logical properties
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldonadel committed Feb 22, 2023
1 parent bc749a1 commit f3ce6da
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
7 changes: 7 additions & 0 deletions React/Views/RCTShadowView.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
@property (nonatomic, assign) YGValue right;
@property (nonatomic, assign) YGValue start;
@property (nonatomic, assign) YGValue end;
@property (nonatomic, assign) YGValue inset;
@property (nonatomic, assign) YGValue insetInline;
@property (nonatomic, assign) YGValue insetInlineEnd;
@property (nonatomic, assign) YGValue insetInlineStart;
@property (nonatomic, assign) YGValue insetBlock;
@property (nonatomic, assign) YGValue insetBlockEnd;
@property (nonatomic, assign) YGValue insetBlockStart;

@property (nonatomic, assign) YGValue width;
@property (nonatomic, assign) YGValue height;
Expand Down
63 changes: 63 additions & 0 deletions React/Views/RCTShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,69 @@ - (YGValue)right
return YGNodeStyleGetPosition(_yogaNode, edge);
}

- (void)setInset:(YGValue)value
{
RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, YGEdgeAll);
}
- (YGValue)inset
{
return YGNodeStyleGetPosition(_yogaNode, YGEdgeAll);
}

- (void)setInsetInline:(YGValue)value
{
RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, YGEdgeHorizontal);
}
- (YGValue)insetInline
{
return YGNodeStyleGetPosition(_yogaNode, YGEdgeHorizontal);
}

- (void)setInsetInlineEnd:(YGValue)value
{
RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, YGEdgeEnd);
}
- (YGValue)insetInlineEnd
{
return YGNodeStyleGetPosition(_yogaNode, YGEdgeEnd);
}

- (void)setInsetInlineStart:(YGValue)value
{
RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, YGEdgeStart);
}
- (YGValue)insetInlineStart
{
return YGNodeStyleGetPosition(_yogaNode, YGEdgeStart);
}

- (void)setInsetBlock:(YGValue)value
{
RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, YGEdgeVertical);
}
- (YGValue)insetBlock
{
return YGNodeStyleGetPosition(_yogaNode, YGEdgeVertical);
}

- (void)setInsetBlockEnd:(YGValue)value
{
RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, YGEdgeBottom);
}
- (YGValue)insetBlockEnd
{
return YGNodeStyleGetPosition(_yogaNode, YGEdgeBottom);
}

- (void)setInsetBlockStart:(YGValue)value
{
RCT_SET_YGVALUE(value, YGNodeStyleSetPosition, _yogaNode, YGEdgeTop);
}
- (YGValue)insetBlockStart
{
return YGNodeStyleGetPosition(_yogaNode, YGEdgeTop);
}

// Size

- (CGSize)size
Expand Down
7 changes: 7 additions & 0 deletions React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ - (RCTShadowView *)shadowView
RCT_EXPORT_SHADOW_PROPERTY(end, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(bottom, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(left, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(inset, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(insetInline, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(insetInlineEnd, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(insetInlineStart, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(insetBlock, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(insetBlockEnd, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(insetBlockStart, YGValue)

RCT_EXPORT_SHADOW_PROPERTY(width, YGValue)
RCT_EXPORT_SHADOW_PROPERTY(height, YGValue)
Expand Down

0 comments on commit f3ce6da

Please sign in to comment.