Added support of direction style property

Summary: Now layout direction (LTR or LTR) can be specified not only for whole app but also for view subtree via `direction` style property.

Reviewed By: mmmulani

Differential Revision: D4510206

fbshipit-source-id: 4e56c5886b6e42f2343165eb76be897e681c5ba4
This commit is contained in:
Valentin Shergin
2017-02-06 20:58:23 -08:00
committed by Facebook Github Bot
parent d73f7d3d5e
commit ec673d0771
14 changed files with 95 additions and 48 deletions

View File

@@ -7,9 +7,10 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTI18nUtil.h"
#import "RCTRootShadowView.h"
#import "RCTI18nUtil.h"
@implementation RCTRootShadowView
/**
@@ -20,9 +21,7 @@
{
self = [super init];
if (self) {
if ([[RCTI18nUtil sharedInstance] isRTL]) {
YGNodeStyleSetDirection(self.cssNode, YGDirectionRTL);
}
self.direction = [[RCTI18nUtil sharedInstance] isRTL] ? YGDirectionRTL : YGDirectionLTR;
}
return self;
}

View File

@@ -146,6 +146,11 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
*/
@property (nonatomic, assign) NSInteger zIndex;
/**
* Interface direction (LTR or RTL)
*/
@property (nonatomic, assign) YGDirection direction;
/**
* Clipping properties
*/

View File

@@ -665,6 +665,7 @@ RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, YGAlign)
RCT_STYLE_PROPERTY(Position, position, PositionType, YGPositionType)
RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, YGWrap)
RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, YGOverflow)
RCT_STYLE_PROPERTY(Direction, direction, Direction, YGDirection)
RCT_STYLE_PROPERTY(AspectRatio, aspectRatio, AspectRatio, float)
- (void)setBackgroundColor:(UIColor *)color

View File

@@ -317,5 +317,6 @@ RCT_EXPORT_SHADOW_PROPERTY(overflow, YGOverflow)
RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock)
RCT_EXPORT_SHADOW_PROPERTY(zIndex, NSInteger)
RCT_EXPORT_SHADOW_PROPERTY(direction, YGDirection)
@end