Provide RTL support for RCTShadowView
Summary: The make current RCTShadowView support RTL layout. Two changes I made: 1 Change all left/right to start/end for margin, padding, boarder and position 2 Change the paddingAsInsets to support RTL Reviewed By: majak Differential Revision: D3548002 fbshipit-source-id: 15cc5228d2d28d0e12a7147daf57967e5b87ee63
This commit is contained in:
parent
e87a02c520
commit
66514869aa
|
@ -60,23 +60,23 @@ static void RCTPrint(void *context)
|
|||
#define DEFINE_PROCESS_META_PROPS(type) \
|
||||
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], CSSNodeRef node) { \
|
||||
if (!isUndefined(metaProps[META_PROP_LEFT])) { \
|
||||
CSSNodeStyleSet##type##Left(node, metaProps[META_PROP_LEFT]); \
|
||||
CSSNodeStyleSet##type##Start(node, metaProps[META_PROP_LEFT]); \
|
||||
} else if (!isUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
CSSNodeStyleSet##type##Left(node, metaProps[META_PROP_HORIZONTAL]); \
|
||||
CSSNodeStyleSet##type##Start(node, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!isUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type##Left(node, metaProps[META_PROP_ALL]); \
|
||||
CSSNodeStyleSet##type##Start(node, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type##Left(node, 0); \
|
||||
CSSNodeStyleSet##type##Start(node, 0); \
|
||||
} \
|
||||
\
|
||||
if (!isUndefined(metaProps[META_PROP_RIGHT])) { \
|
||||
CSSNodeStyleSet##type##Right(node, metaProps[META_PROP_RIGHT]); \
|
||||
CSSNodeStyleSet##type##End(node, metaProps[META_PROP_RIGHT]); \
|
||||
} else if (!isUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||
CSSNodeStyleSet##type##Right(node, metaProps[META_PROP_HORIZONTAL]); \
|
||||
CSSNodeStyleSet##type##End(node, metaProps[META_PROP_HORIZONTAL]); \
|
||||
} else if (!isUndefined(metaProps[META_PROP_ALL])) { \
|
||||
CSSNodeStyleSet##type##Right(node, metaProps[META_PROP_ALL]); \
|
||||
CSSNodeStyleSet##type##End(node, metaProps[META_PROP_ALL]); \
|
||||
} else { \
|
||||
CSSNodeStyleSet##type##Right(node, 0); \
|
||||
CSSNodeStyleSet##type##End(node, 0); \
|
||||
} \
|
||||
\
|
||||
if (!isUndefined(metaProps[META_PROP_TOP])) { \
|
||||
|
@ -470,12 +470,29 @@ RCT_PADDING_PROPERTY(Right, RIGHT)
|
|||
|
||||
- (UIEdgeInsets)paddingAsInsets
|
||||
{
|
||||
if (CSSNodeLayoutGetDirection(_cssNode) == CSSDirectionRTL) {
|
||||
return (UIEdgeInsets){
|
||||
CSSNodeStyleGetPaddingTop(_cssNode),
|
||||
!isUndefined(CSSNodeStyleGetPaddingEnd(_cssNode)) ?
|
||||
CSSNodeStyleGetPaddingEnd(_cssNode) :
|
||||
CSSNodeStyleGetPaddingLeft(_cssNode),
|
||||
CSSNodeStyleGetPaddingBottom(_cssNode),
|
||||
!isUndefined(CSSNodeStyleGetPaddingStart(_cssNode)) ?
|
||||
CSSNodeStyleGetPaddingStart(_cssNode) :
|
||||
CSSNodeStyleGetPaddingRight(_cssNode)
|
||||
};
|
||||
} else {
|
||||
return (UIEdgeInsets){
|
||||
CSSNodeStyleGetPaddingTop(_cssNode),
|
||||
!isUndefined(CSSNodeStyleGetPaddingStart(_cssNode)) ?
|
||||
CSSNodeStyleGetPaddingStart(_cssNode) :
|
||||
CSSNodeStyleGetPaddingLeft(_cssNode),
|
||||
CSSNodeStyleGetPaddingBottom(_cssNode),
|
||||
!isUndefined(CSSNodeStyleGetPaddingEnd(_cssNode)) ?
|
||||
CSSNodeStyleGetPaddingEnd(_cssNode) :
|
||||
CSSNodeStyleGetPaddingRight(_cssNode)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Border
|
||||
|
@ -521,9 +538,9 @@ RCT_DIMENSION_PROPERTY(MaxHeight, maxHeight, MaxHeight)
|
|||
// Position
|
||||
|
||||
RCT_DIMENSION_PROPERTY(Top, top, PositionTop)
|
||||
RCT_DIMENSION_PROPERTY(Right, right, PositionRight)
|
||||
RCT_DIMENSION_PROPERTY(Right, right, PositionEnd)
|
||||
RCT_DIMENSION_PROPERTY(Bottom, bottom, PositionBottom)
|
||||
RCT_DIMENSION_PROPERTY(Left, left, PositionLeft)
|
||||
RCT_DIMENSION_PROPERTY(Left, left, PositionStart)
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue