From e7c41ec5fb4d7c778749efcda8d450ecc6cdfa18 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 RCTInputAccessoryComponentView" Summary: Original commit changeset: a3324b5df6e6 ConcreteStateTeller is being replaced with a new built-in state autorepeat mechanism. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D25687697 fbshipit-source-id: 849bb8b6c244b17a49b5fe140346d90a9a7e52ff --- .../RCTInputAccessoryComponentView.mm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm index d151d1c0c3..e53c8570d9 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm @@ -41,7 +41,7 @@ static UIView *_Nullable RCTFindTextInputWithNat } @implementation RCTInputAccessoryComponentView { - InputAccessoryShadowNode::ConcreteStateTeller _stateTeller; + InputAccessoryShadowNode::ConcreteState::Shared _state; RCTInputAccessoryContentView *_contentView; RCTSurfaceTouchHandler *_touchHandler; UIView __weak *_textInput; @@ -118,15 +118,16 @@ static UIView *_Nullable RCTFindTextInputWithNat self.hidden = true; } -- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState +- (void)updateState:(const facebook::react::State::Shared &)state + oldState:(const facebook::react::State::Shared &)oldState { - _stateTeller.setConcreteState(state); - CGSize oldViewportSize = RCTCGSizeFromSize(_stateTeller.getData().value().viewportSize); + _state = std::static_pointer_cast(state); + CGSize oldScreenSize = RCTCGSizeFromSize(_state->getData().viewportSize); CGSize viewportSize = RCTViewportSize(); viewportSize.height = std::nan(""); - if (oldViewportSize.width != viewportSize.width) { + if (oldScreenSize.width != viewportSize.width) { auto stateData = InputAccessoryState{RCTSizeFromCGSize(viewportSize)}; - _stateTeller.updateState(std::move(stateData)); + _state->updateState(std::move(stateData)); } } @@ -141,7 +142,7 @@ static UIView *_Nullable RCTFindTextInputWithNat - (void)prepareForRecycle { [super prepareForRecycle]; - _stateTeller.invalidate(); + _state.reset(); _textInput = nil; }