From a0beb3a437a19693aa25a1acfc2ae59c1e97e131 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Wed, 23 Dec 2020 10:06:35 -0800 Subject: [PATCH] Back out "Use ConcreteStateTeller in RCTModalHostViewComponentView" Summary: Original commit changeset: b82301e5db48 ConcreteStateTeller is being replaced with a new built-in state autorepeat mechanism. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D25687694 fbshipit-source-id: 17a737d394cb7f460b239be421466981bc46f995 --- .../Modal/RCTModalHostViewComponentView.mm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm index 01648dd2f42..cdbb147bba3 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm @@ -98,7 +98,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct( @implementation RCTModalHostViewComponentView { RCTFabricModalHostViewController *_viewController; - ModalHostViewShadowNode::ConcreteStateTeller _stateTeller; + ModalHostViewShadowNode::ConcreteState::Shared _state; BOOL _shouldAnimatePresentation; BOOL _isPresented; UIView *_modalContentsSnapshot; @@ -201,8 +201,10 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct( eventEmitter->onOrientationChange(onOrientationChangeStruct(newBounds)); } - auto newState = ModalHostViewState{RCTSizeFromCGSize(newBounds.size)}; - _stateTeller.updateState(std::move(newState)); + if (_state != nullptr) { + auto newState = ModalHostViewState{RCTSizeFromCGSize(newBounds.size)}; + _state->updateState(std::move(newState)); + } } #pragma mark - RCTComponentViewProtocol @@ -215,7 +217,7 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct( - (void)prepareForRecycle { [super prepareForRecycle]; - _stateTeller.invalidate(); + _state.reset(); _viewController = nil; _isPresented = NO; } @@ -237,9 +239,10 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct( [super updateProps:props oldProps:oldProps]; } -- (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); } - (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index