th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.14k stars 197 forks source link

fix: 🐛 empty array sets no edges #378

Closed VNDRN closed 1 year ago

VNDRN commented 1 year ago

Summary

As #204 states, providing an empty array as edges to the SafeAreaView component should result into no edges being set. When the edges prop is omitted, all edges should still be set as default

Test Plan

I've tested this on an iPhone 14 Pro

<SafeAreaView edges={[]} style={{ backgroundColor: 'blue', flex: 1 }}>
      <View style={{ backgroundColor: 'red', flex: 1 }} />
 </SafeAreaView>
no edges (defaults to all) edges={['bottom']} edges={[]}
IMG_3120 IMG_3121 IMG_3119
VNDRN commented 1 year ago

I haven't been able to test if a change needs to be made for android

VNDRN commented 1 year ago

I've tried simulating display cutouts with developer options, but couldn't provide any. As this is an iOS only change, it shouldn't affect android though?

jacobp100 commented 1 year ago

@janicduplessis happy for this to go in?

janicduplessis commented 1 year ago

Looks good, not sure if the same bug exists on android, but if it does we can fix it later, this will only affect iOS.