Created
February 25, 2019 15:11
-
-
Save KanshuYokoo/a30f7f923ceade4c7b3553f1287a1c85 to your computer and use it in GitHub Desktop.
Reac-Native: how to place icon images vertical and horizontal centre over background
This file contains hidden or 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
const { width, height } = Dimensions.get('window') | |
const sizeStyle = { | |
width: width, | |
height: height | |
} | |
const styleImage = { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center' | |
} | |
const styleBackImage = { | |
position: 'absolute' | |
} | |
const styleIconImage = { | |
width: 43, | |
height: 59 | |
} | |
return ( | |
<View style={[sizeStyle, styleImage]}> | |
<View style={[sizeStyle, styleBackImage]}> | |
<Image source={require('../assets/background.png')} /> | |
</View> | |
<View > | |
<Image style={styleIconImage} source={require('../assets/icon.png')} /> | |
</View> | |
</View> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment