Skip to content

Instantly share code, notes, and snippets.

@anatooly
Created October 11, 2022 08:48
Show Gist options
  • Save anatooly/1fb848b1ecfd3b3a0d8d3aa6fbdc344e to your computer and use it in GitHub Desktop.
Save anatooly/1fb848b1ecfd3b3a0d8d3aa6fbdc344e to your computer and use it in GitHub Desktop.
SafeAreaBackground.js
import React from 'react'
import {SafeAreaView} from 'react-native-safe-area-context'
const SafeAreaBackground = ({
children = null,
backgroundColorTop = '',
backgroundColorBottom = '',
}) => {
return (
<>
<SafeAreaView
edges={['top']}
style={{flex: 0, backgroundColor: backgroundColorTop}}
/>
<SafeAreaView
edges={['left', 'right', 'bottom']}
style={{
flex: 1,
backgroundColor: backgroundColorBottom,
position: 'relative',
}}>
{children}
</SafeAreaView>
</>
)
}
export default SafeAreaBackground
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment