From b8bc40e2f0ed06539aaa17f35801187f8f3520a6 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Wed, 12 Jun 2019 21:13:46 -0700 Subject: [PATCH] Fabric: Removing checks for `oldProps` object in `[ComponentView updateProps:oldProps:]` Summary: It's a antient left over which was copy pasted a dozen of times. All `RCTViewComponentView` subclasses have own copy of the old props `_props`, so it's useless to check for `oldProps`. Reviewed By: mdvacca Differential Revision: D15770067 fbshipit-source-id: 39f4d71ccdcf0c9a5b911b17a3b922dbe6dd9a8e --- .../ActivityIndicator/RCTActivityIndicatorViewComponentView.mm | 2 +- .../Mounting/ComponentViews/Image/RCTImageComponentView.mm | 2 +- .../ComponentViews/ScrollView/RCTScrollViewComponentView.mm | 2 +- .../ScrollView/RNPullToRefreshViewComponentView.mm | 2 +- .../Mounting/ComponentViews/Slider/RCTSliderComponentView.mm | 2 +- .../Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm | 2 +- .../RCTUnimplementedNativeComponentView.mm | 2 +- .../Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm index c1ac244f05f..4dbb3150a28 100644 --- a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm @@ -60,7 +60,7 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { - const auto &oldViewProps = *std::static_pointer_cast(oldProps ?: _props); + const auto &oldViewProps = *std::static_pointer_cast(_props); const auto &newViewProps = *std::static_pointer_cast(props); [super updateProps:props oldProps:oldProps]; diff --git a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm index c85e0a8837f..d20eba79641 100644 --- a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm @@ -52,7 +52,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { - const auto &oldImageProps = *std::static_pointer_cast(oldProps ?: _props); + const auto &oldImageProps = *std::static_pointer_cast(_props); const auto &newImageProps = *std::static_pointer_cast(props); [super updateProps:props oldProps:oldProps]; diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 5ed4ed9e218..faba12d0783 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -71,7 +71,7 @@ using namespace facebook::react; - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { - const auto &oldScrollViewProps = *std::static_pointer_cast(oldProps ?: _props); + const auto &oldScrollViewProps = *std::static_pointer_cast(_props); const auto &newScrollViewProps = *std::static_pointer_cast(props); [super updateProps:props oldProps:oldProps]; diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RNPullToRefreshViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RNPullToRefreshViewComponentView.mm index 44705d83fb2..1186ad90507 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RNPullToRefreshViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RNPullToRefreshViewComponentView.mm @@ -50,7 +50,7 @@ using namespace facebook::react; - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { - auto const &oldConcreteProps = *std::static_pointer_cast(oldProps ?: _props); + auto const &oldConcreteProps = *std::static_pointer_cast(_props); auto const &newConcreteProps = *std::static_pointer_cast(props); [super updateProps:props oldProps:oldProps]; diff --git a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm index 30dcb945638..dd650140398 100644 --- a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm @@ -109,7 +109,7 @@ using namespace facebook::react; - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { - const auto &oldSliderProps = *std::static_pointer_cast(oldProps ?: _props); + const auto &oldSliderProps = *std::static_pointer_cast(_props); const auto &newSliderProps = *std::static_pointer_cast(props); [super updateProps:props oldProps:oldProps]; diff --git a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm index 24a84a5dfda..bc5f7fc323c 100644 --- a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm @@ -45,7 +45,7 @@ using namespace facebook::react; - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { - const auto &oldSwitchProps = *std::static_pointer_cast(oldProps ?: _props); + const auto &oldSwitchProps = *std::static_pointer_cast(_props); const auto &newSwitchProps = *std::static_pointer_cast(props); [super updateProps:props oldProps:oldProps]; diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm index f231a2d2eae..bbc1ba305ca 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm @@ -47,7 +47,7 @@ using namespace facebook::react; - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps { - const auto &oldViewProps = *std::static_pointer_cast(oldProps ?: _props); + const auto &oldViewProps = *std::static_pointer_cast(_props); const auto &newViewProps = *std::static_pointer_cast(props); [super updateProps:props oldProps:oldProps]; diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index 48fed7a7201..b627db40cbc 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -107,7 +107,7 @@ using namespace facebook::react; NSStringFromClass([self class])); #endif - auto const &oldViewProps = *std::static_pointer_cast(oldProps ?: _props); + auto const &oldViewProps = *std::static_pointer_cast(_props); auto const &newViewProps = *std::static_pointer_cast(props); _props = std::static_pointer_cast(props);