Fixes SafeAreaView when set emulateUnlessSupported on safeArea supported devices (#24615)

Summary:
On safeArea supported devices like `iPhoneX`, we need to forbid invalidate `safeAreaInsets` when set `emulateUnlessSupported` prop, otherwise `SafeAreaView` would broken.

cc. cpojer shergin .

Before:
![before](https://user-images.githubusercontent.com/5061845/56792861-33088180-683d-11e9-8183-a1c8a5c9cb37.gif)

After:
![after](https://user-images.githubusercontent.com/5061845/56792867-38fe6280-683d-11e9-9b4d-01848b42a9b0.gif)

[iOS] [Fixed] - Fixes SafeAreaView when set emulateUnlessSupported on safeArea supported devices
Pull Request resolved: https://github.com/facebook/react-native/pull/24615

Differential Revision: D15122211

Pulled By: cpojer

fbshipit-source-id: 8a1c3f2aedbde707d8d6c8f36c97e6424585dc59
This commit is contained in:
zhongwuzw
2019-04-29 09:59:37 -07:00
committed by Facebook Github Bot
parent 6f6696fa63
commit f75d47c915

View File

@@ -118,6 +118,10 @@ static BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIE
}
_emulateUnlessSupported = emulateUnlessSupported;
if ([self isSupportedByOS]) {
return;
}
[self invalidateSafeAreaInsets];
}