react-native-safe-area-context icon indicating copy to clipboard operation
react-native-safe-area-context copied to clipboard

Margin mode on iOS can sometimes get stuck with invalid safe area insets

Open jacobp100 opened this issue 4 years ago • 1 comments

I had something like the following,

<SafeAreaView
  style={{ position: 'absolute', left: 0 }}
  edges="left"
  mode="margin"
/>

When I rotate to landscape and back to portrait, it gets stuck with the landscape insets

I suspect this is because iOS's safeArea prop does not change if you're outside the safe area insets - which you will be going from landscape to portrait. Maybe we should check if the safeArea changed in onLayout

jacobp100 avatar May 30 '20 09:05 jacobp100

@janicduplessis I think this could be fixed by emitting an NSNotification from RNCSafeAreaProvider, and having the views subscribe to that (with id:_providerView)

Would you accept a PR with this change?

jacobp100 avatar Sep 20 '21 16:09 jacobp100