From 04fa09afeff0c834236e893933bc261b47b09cfa Mon Sep 17 00:00:00 2001 From: chirag04 Date: Tue, 14 Jul 2015 17:03:41 -0700 Subject: [PATCH] [Style] added backface-visibility. fixes #1973 Summary: default behavior remains same(backface visible). cc @sahrens Closes https://github.com/facebook/react-native/pull/1977 Github Author: chirag04 --- Libraries/Components/View/ViewStylePropTypes.js | 1 + React/Base/RCTConvert.h | 3 ++- React/Base/RCTConvert.m | 5 +++++ React/Views/RCTViewManager.m | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/View/ViewStylePropTypes.js b/Libraries/Components/View/ViewStylePropTypes.js index ce147e096..64ace6d7b 100644 --- a/Libraries/Components/View/ViewStylePropTypes.js +++ b/Libraries/Components/View/ViewStylePropTypes.js @@ -21,6 +21,7 @@ var TransformPropTypes = require('TransformPropTypes'); var ViewStylePropTypes = { ...LayoutPropTypes, ...TransformPropTypes, + backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']), backgroundColor: ReactPropTypes.string, borderColor: ReactPropTypes.string, borderTopColor: ReactPropTypes.string, diff --git a/React/Base/RCTConvert.h b/React/Base/RCTConvert.h index 1b010accd..50b677dd9 100644 --- a/React/Base/RCTConvert.h +++ b/React/Base/RCTConvert.h @@ -120,8 +120,9 @@ typedef NSArray CGColorArray; typedef id NSPropertyList; + (NSPropertyList)NSPropertyList:(id)json; -typedef BOOL css_clip_t; +typedef BOOL css_clip_t, css_backface_visibility_t; + (css_clip_t)css_clip_t:(id)json; ++ (css_backface_visibility_t)css_backface_visibility_t:(id)json; + (css_flex_direction_t)css_flex_direction_t:(id)json; + (css_justify_t)css_justify_t:(id)json; + (css_align_t)css_align_t:(id)json; diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index c78cc8d74..e61e6f6ed 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -993,6 +993,11 @@ static id RCTConvertPropertyListValue(id json) return RCTConvertPropertyListValue(json); } +RCT_ENUM_CONVERTER(css_backface_visibility_t, (@{ + @"hidden": @NO, + @"visible": @YES +}), YES, boolValue) + RCT_ENUM_CONVERTER(css_clip_t, (@{ @"hidden": @YES, @"visible": @NO diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index ce027bbed..9be9087f6 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -96,6 +96,7 @@ RCT_EXPORT_VIEW_PROPERTY(accessibilityTraits, UIAccessibilityTraits) RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) RCT_REMAP_VIEW_PROPERTY(accessible, isAccessibilityElement, BOOL) RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString) +RCT_REMAP_VIEW_PROPERTY(backfaceVisibility, layer.doubleSided, css_backface_visibility_t) RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat) RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor); RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize);