Use ConcreteStateTeller in RCTInputAccessoryComponentView
Summary: Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D23239095 fbshipit-source-id: a3324b5df6e6bd7508d74b66de9235852d828bbd
This commit is contained in:
Родитель
0b532e1be7
Коммит
0f7a1145ff
|
@ -40,7 +40,7 @@ static UIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNat
|
|||
}
|
||||
|
||||
@implementation RCTInputAccessoryComponentView {
|
||||
InputAccessoryShadowNode::ConcreteState::Shared _state;
|
||||
InputAccessoryShadowNode::ConcreteStateTeller _stateTeller;
|
||||
RCTInputAccessoryContentView *_contentView;
|
||||
RCTSurfaceTouchHandler *_touchHandler;
|
||||
UIView<RCTBackedTextInputViewProtocol> __weak *_textInput;
|
||||
|
@ -117,16 +117,15 @@ static UIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNat
|
|||
self.hidden = true;
|
||||
}
|
||||
|
||||
- (void)updateState:(const facebook::react::State::Shared &)state
|
||||
oldState:(const facebook::react::State::Shared &)oldState
|
||||
- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState
|
||||
{
|
||||
_state = std::static_pointer_cast<InputAccessoryShadowNode::ConcreteState const>(state);
|
||||
CGSize oldScreenSize = RCTCGSizeFromSize(_state->getData().screenSize);
|
||||
_stateTeller.setConcreteState(state);
|
||||
CGSize oldScreenSize = RCTCGSizeFromSize(_stateTeller.getData().value().screenSize);
|
||||
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
|
||||
screenSize.height = std::nan("");
|
||||
if (oldScreenSize.width != screenSize.width) {
|
||||
auto stateData = InputAccessoryState{RCTSizeFromCGSize(screenSize)};
|
||||
_state->updateState(std::move(stateData));
|
||||
_stateTeller.updateState(std::move(stateData));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +140,7 @@ static UIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWithNat
|
|||
- (void)prepareForRecycle
|
||||
{
|
||||
[super prepareForRecycle];
|
||||
_state.reset();
|
||||
_stateTeller.invalidate();
|
||||
_textInput = nil;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче