mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bfb2c4be99
commit
04de0e75a0
@@ -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<SafeAreaViewShadowNode::ConcreteState const>(state);
|
||||
[self _updateStateIfNecessary];
|
||||
}
|
||||
|
||||
- (void)prepareForRecycle
|
||||
{
|
||||
[super prepareForRecycle];
|
||||
_stateTeller.invalidate();
|
||||
_state.reset();
|
||||
_lastPaddingStateWasUpdatedWith = {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user