Fix state.padding being out of sync with safe area view

Summary:
Changelog: [Internal]

# Problem

SafeAreaView is getting reused, its previous `safeAreaInsets` is top: 44, bottom: 34 so `safeAreaInsetsDidChange` doesn't get called because it doesn't change. Therefore state gets never updates because `safeAreaInsetsDidChange` is never called.

# Solution

Update state whenever a new state is assigned.

Reviewed By: shergin

Differential Revision: D20444198

fbshipit-source-id: 75d1458450c70d74647df4962ddad88d5f6a38d2
This commit is contained in:
Samuel Susla
2020-03-16 02:43:29 -07:00
committed by Facebook GitHub Bot
parent c774cb8ec5
commit 1f4535c175
@@ -49,6 +49,11 @@ using namespace facebook::react;
{
[super safeAreaInsetsDidChange];
[self _updateStateIfNecessary];
}
- (void)_updateStateIfNecessary
{
if (!_state) {
return;
}
@@ -78,6 +83,7 @@ using namespace facebook::react;
oldState:(facebook::react::State::Shared const &)oldState
{
_state = std::static_pointer_cast<SafeAreaViewShadowNode::ConcreteState const>(state);
[self _updateStateIfNecessary];
}
+ (ComponentDescriptorProvider)componentDescriptorProvider