Converted zIndex to integers

Summary: Converted the zIndex property on iOS to NSInteger instead of double. This is consistent with the CSS spec, and helps to simplify the Android implementation.

Reviewed By: javache

Differential Revision: D3411491

fbshipit-source-id: 902ebc29aac39a65f7e8707a28607655f9f5052c
This commit is contained in:
Nick Lockwood 2016-06-09 09:48:56 -07:00 committed by Facebook Github Bot 3
parent eef03fd552
commit a05e05fafb
6 changed files with 9 additions and 9 deletions

View File

@ -132,7 +132,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
/** /**
* z-index, used to override sibling order in the view * z-index, used to override sibling order in the view
*/ */
@property (nonatomic, assign) double zIndex; @property (nonatomic, assign) NSInteger zIndex;
/** /**
* Calculate property changes that need to be propagated to the view. * Calculate property changes that need to be propagated to the view.

View File

@ -610,7 +610,7 @@ RCT_STYLE_PROPERTY(FlexWrap, flexWrap, flex_wrap, css_wrap_type_t)
[self dirtyPropagation]; [self dirtyPropagation];
} }
- (void)setZIndex:(double)zIndex - (void)setZIndex:(NSInteger)zIndex
{ {
_zIndex = zIndex; _zIndex = zIndex;
if (_superview) { if (_superview) {

View File

@ -46,7 +46,7 @@
* inherited from UIView+React, but we override it here to reduce the boxing * inherited from UIView+React, but we override it here to reduce the boxing
* and associated object overheads. * and associated object overheads.
*/ */
@property (nonatomic, assign) double reactZIndex; @property (nonatomic, assign) NSInteger reactZIndex;
/** /**
* This is an optimization used to improve performance * This is an optimization used to improve performance

View File

@ -246,7 +246,7 @@ RCT_VIEW_BORDER_RADIUS_PROPERTY(TopRight)
RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomLeft) RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomLeft)
RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomRight) RCT_VIEW_BORDER_RADIUS_PROPERTY(BottomRight)
RCT_REMAP_VIEW_PROPERTY(zIndex, reactZIndex, double) RCT_REMAP_VIEW_PROPERTY(zIndex, reactZIndex, NSInteger)
#pragma mark - ShadowView properties #pragma mark - ShadowView properties
@ -292,6 +292,6 @@ RCT_EXPORT_SHADOW_PROPERTY(position, css_position_type_t)
RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock) RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock)
RCT_EXPORT_SHADOW_PROPERTY(zIndex, double) RCT_EXPORT_SHADOW_PROPERTY(zIndex, NSInteger)
@end @end

View File

@ -28,7 +28,7 @@
/** /**
* z-index, used to override sibling order in didUpdateReactSubviews. * z-index, used to override sibling order in didUpdateReactSubviews.
*/ */
@property (nonatomic, assign) double reactZIndex; @property (nonatomic, assign) NSInteger reactZIndex;
/** /**
* The reactSubviews array, sorted by zIndex. This value is cached and * The reactSubviews array, sorted by zIndex. This value is cached and

View File

@ -87,12 +87,12 @@
[subview removeFromSuperview]; [subview removeFromSuperview];
} }
- (double)reactZIndex - (NSInteger)reactZIndex
{ {
return [objc_getAssociatedObject(self, _cmd) doubleValue]; return [objc_getAssociatedObject(self, _cmd) integerValue];
} }
- (void)setReactZIndex:(double)reactZIndex - (void)setReactZIndex:(NSInteger)reactZIndex
{ {
objc_setAssociatedObject(self, @selector(reactZIndex), @(reactZIndex), OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, @selector(reactZIndex), @(reactZIndex), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }