JS only version of SafeAreaView for supporting iPhone X safe area insets.
Clone or download
Latest commit 34dd27c Jan 9, 2019



This is a JS-only version of SafeAreaView that will be available in React Native v0.50.0, to be released at the beginning of November. This version also adds a small api that makes SafeAreaView more flexible for complex UIs. React Navigation already includes and uses this view starting in v1.0.0-beta.16.


Wrap components that touch any edge of the screen with SafeAreaView.

    <Text>Look, I'm safe!</Text>


Sometimes you will observe unexpected behavior and jank because SafeAreaView uses onLayout then calls measureInWindow on the view. If you know your view will touch certain edges, use forceInset to force it to apply the inset padding on the view.

<SafeAreaView forceInset={{ top: 'always' }}>
    <Text>Yeah, I'm safe too!</Text>

forceInset takes an object with the keys top | bottom | left | right | vertical | horizontal and the values 'always' | 'never'. Or you can override the padding altogether by passing an integer.

With HOC

Sometimes you would prefer to use a higher-order component to wrap components.


// Or with forceInset props
withSafeArea({ top: 'always' })(Component);