Created
October 11, 2022 08:48
-
-
Save anatooly/1fb848b1ecfd3b3a0d8d3aa6fbdc344e to your computer and use it in GitHub Desktop.
SafeAreaBackground.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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