mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use ConcreteStateTeller in RCTSafeAreaViewComponentView
Summary: Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D23238703 fbshipit-source-id: 67596194b599ce8d39a6e7403bf61dce0fd61434
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e454863bca
commit
724952e5d6
@@ -17,7 +17,7 @@
|
||||
using namespace facebook::react;
|
||||
|
||||
@implementation RCTSafeAreaViewComponentView {
|
||||
SafeAreaViewShadowNode::ConcreteState::Shared _state;
|
||||
SafeAreaViewShadowNode::ConcreteStateTeller _stateTeller;
|
||||
EdgeInsets _lastPaddingStateWasUpdatedWith;
|
||||
}
|
||||
|
||||
@@ -50,10 +50,6 @@ using namespace facebook::react;
|
||||
|
||||
- (void)_updateStateIfNecessary
|
||||
{
|
||||
if (!_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIEdgeInsets insets = [self _safeAreaInsets];
|
||||
insets.left = RCTRoundPixelValue(insets.left);
|
||||
insets.top = RCTRoundPixelValue(insets.top);
|
||||
@@ -70,22 +66,21 @@ using namespace facebook::react;
|
||||
}
|
||||
|
||||
_lastPaddingStateWasUpdatedWith = newPadding;
|
||||
_state->updateState(SafeAreaViewState{newPadding});
|
||||
_stateTeller.updateState(SafeAreaViewState{newPadding});
|
||||
}
|
||||
|
||||
#pragma mark - RCTComponentViewProtocol
|
||||
|
||||
- (void)updateState:(facebook::react::State::Shared const &)state
|
||||
oldState:(facebook::react::State::Shared const &)oldState
|
||||
- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState
|
||||
{
|
||||
_state = std::static_pointer_cast<SafeAreaViewShadowNode::ConcreteState const>(state);
|
||||
_stateTeller.setConcreteState(state);
|
||||
[self _updateStateIfNecessary];
|
||||
}
|
||||
|
||||
- (void)prepareForRecycle
|
||||
{
|
||||
[super prepareForRecycle];
|
||||
_state.reset();
|
||||
_stateTeller.invalidate();
|
||||
_lastPaddingStateWasUpdatedWith = {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user