diff --git a/React/Views/RCTComponentData.m b/React/Views/RCTComponentData.m index d7738b05290a73..46eb77a8a3665b 100644 --- a/React/Views/RCTComponentData.m +++ b/React/Views/RCTComponentData.m @@ -234,9 +234,8 @@ - (RCTPropBlock)propBlockForKey:(NSString *)name setterBlock = ^(id target, id json) { \ if (json) { \ if (!setDefaultValue && target) { \ - if ([target respondsToSelector:getter]) { \ - defaultValue = get(target, getter); \ - } \ + RCTAssert([target respondsToSelector:getter], @"prop getter does not exist: %@", NSStringFromSelector(getter)); \ + defaultValue = get(target, getter); \ setDefaultValue = YES; \ } \ set(target, setter, convert([RCTConvert class], type, json)); \ diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index da9a8a83a62459..a3bac95eb5a294 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -636,6 +636,11 @@ - (void)setFlex:(float)value YGNodeStyleSetFlex(_cssNode, value); } +- (float)flex +{ + return YGNodeStyleGetFlex(_cssNode); +} + - (void)setFlexBasis:(YGValue)value { RCT_SET_YGVALUE(value, YGNodeStyleSetFlexBasis, _cssNode); diff --git a/React/Views/RCTSwitch.m b/React/Views/RCTSwitch.m index 6c4e2856495931..a14cf7051c9669 100644 --- a/React/Views/RCTSwitch.m +++ b/React/Views/RCTSwitch.m @@ -14,6 +14,12 @@ @implementation RCTSwitch +// `on` is a component prop, so we must expose symmetrical `on` and `setOn` methods. +// UIView breaks convention with the name `isOn`, so we simply forward. +- (BOOL)on { + return [self isOn]; +} + - (void)setOn:(BOOL)on animated:(BOOL)animated { _wasOn = on; [super setOn:on animated:animated]; diff --git a/React/Views/RCTTabBar.m b/React/Views/RCTTabBar.m index e6fa3490c85cdb..b53b86cba4c219 100644 --- a/React/Views/RCTTabBar.m +++ b/React/Views/RCTTabBar.m @@ -149,6 +149,15 @@ - (void)setTranslucent:(BOOL)translucent { _tabController.tabBar.translucent = translucent; } +- (UIColor *)unselectedItemTintColor { +#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + if ([_tabController.tabBar respondsToSelector:@selector(unselectedItemTintColor)]) { + return _tabController.tabBar.unselectedItemTintColor; + } +#endif + return nil; +} + - (void)setUnselectedItemTintColor:(UIColor *)unselectedItemTintColor { #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 if ([_tabController.tabBar respondsToSelector:@selector(unselectedItemTintColor)]) { diff --git a/ReactCommon/yoga/yoga/Yoga.c b/ReactCommon/yoga/yoga/Yoga.c index a6dde07d56019c..799572f09e01e0 100644 --- a/ReactCommon/yoga/yoga/Yoga.c +++ b/ReactCommon/yoga/yoga/Yoga.c @@ -442,6 +442,10 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) { } } +float YGNodeStyleGetFlex(const YGNodeRef node) { + return node->style.flex; +} + #define YG_NODE_PROPERTY_IMPL(type, name, paramName, instanceName) \ void YGNodeSet##name(const YGNodeRef node, type paramName) { \ node->instanceName = paramName; \ diff --git a/ReactCommon/yoga/yoga/Yoga.h b/ReactCommon/yoga/yoga/Yoga.h index bf9bd3e894321d..eed58935405317 100644 --- a/ReactCommon/yoga/yoga/Yoga.h +++ b/ReactCommon/yoga/yoga/Yoga.h @@ -160,6 +160,7 @@ YG_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow); YG_NODE_STYLE_PROPERTY(YGDisplay, Display, display); WIN_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex); +WIN_EXPORT float YGNodeStyleGetFlex(const YGNodeRef node); YG_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow); YG_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink); YG_NODE_STYLE_PROPERTY_UNIT(YGValue, FlexBasis, flexBasis);