This is a simple component that lets you know what the insets/paddings for safe area are. Helps when adding support for iPhone X and similar devices.
npm install react-native-safe-area-helper --saveimport SafeAreaHelper, { type SafeAreaInsets } from 'react-native-safe-area-helper'
class App extends Component {
onInsetsChange = (insets: SafeAreaInsets) => {
console.log(insets) // { top: 44, bottom: 20, left: 22, right: 0, }
}
render() {
return (
<View>
...
// It tries to fill the whole screen with absolute transparent view
<SafeAreaHelper onInsetsChange={this.onInsetsChange} />
</View>
)
}
}