From 04de0e75a00630e0d3c715fe5aec519e4d9cb0ab Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Wed, 4 Nov 2020 08:08:26 -0800 Subject: [PATCH] Back out "Use ConcreteStateTeller in RCTSafeAreaViewComponentView" Summary: We don't need StateTeller anymore because we already shipped state-autorepeat mechanism on Android. Original commit changeset: 67596194b599 Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross Differential Revision: D24719346 fbshipit-source-id: 798b6897c49c45ffbf481e6d1be17bc5e7810f27 --- .../SafeAreaView/RCTSafeAreaViewComponentView.mm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm index 7623c1099f9..78a1514350f 100644 --- a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm @@ -17,7 +17,7 @@ using namespace facebook::react; @implementation RCTSafeAreaViewComponentView { - SafeAreaViewShadowNode::ConcreteStateTeller _stateTeller; + SafeAreaViewShadowNode::ConcreteState::Shared _state; EdgeInsets _lastPaddingStateWasUpdatedWith; } @@ -50,6 +50,10 @@ using namespace facebook::react; - (void)_updateStateIfNecessary { + if (!_state) { + return; + } + UIEdgeInsets insets = [self _safeAreaInsets]; insets.left = RCTRoundPixelValue(insets.left); insets.top = RCTRoundPixelValue(insets.top); @@ -66,21 +70,22 @@ using namespace facebook::react; } _lastPaddingStateWasUpdatedWith = newPadding; - _stateTeller.updateState(SafeAreaViewState{newPadding}); + _state->updateState(SafeAreaViewState{newPadding}); } #pragma mark - RCTComponentViewProtocol -- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState +- (void)updateState:(facebook::react::State::Shared const &)state + oldState:(facebook::react::State::Shared const &)oldState { - _stateTeller.setConcreteState(state); + _state = std::static_pointer_cast(state); [self _updateStateIfNecessary]; } - (void)prepareForRecycle { [super prepareForRecycle]; - _stateTeller.invalidate(); + _state.reset(); _lastPaddingStateWasUpdatedWith = {}; }