Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Created April 30, 2020 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllGistsEqual/dcc5ea4287bb53a744d251771d1f1071 to your computer and use it in GitHub Desktop.
Save AllGistsEqual/dcc5ea4287bb53a744d251771d1f1071 to your computer and use it in GitHub Desktop.
import React from 'react'
import PropTypes from 'prop-types'
import { StyleSheet, ImageBackground } from 'react-native'
const BackgroundPage = ({ background, children }) => (
<ImageBackground source={background} style={styles.imageBackground}>
{children}
</ImageBackground>
)
const styles = StyleSheet.create({
imageBackground: {
flex: 1,
flexDirection: 'column',
resizeMode: 'cover',
alignItems: 'center',
justifyContent: 'center',
},
})
BackgroundPage.propTypes = {
background: PropTypes.number.isRequired,
children: PropTypes.node.isRequired,
}
export default BackgroundPage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment