I am building an app that makes an invitation Card, I am making the card by using ImageBackground then style the content inside it, but I faced a problem with the different screen size and resolution, my codes are as below:
<ImageBackground
resizeMode='contain'
backgroundColor={this.state.bgColor}
style={{
height: height / 3 + 20,
width: width,}}
source={this.state.border}>
<View style={{ flex: 1, marginRight: 10,
marginLeft: 45, marginTop: 10 }}>
<Text style={{ fontSize: height / 37,
color: this.state.fontColor,
fontWeight: '700',
textAlign: 'center',
fontFamily: this.fonttext }}>{this.type}</Text>
<Text style={{ marginLeft: 40,
marginRight: 5, marginTop: 10,
fontSize: height / 48,
color: this.state.fontColor,
textAlign: 'right',
fontFamily: this.fonttext }}>{this.body}</Text>
<Text style={{ fontSize: height / 49,
marginTop: 10,
color: this.state.fontColor,
textAlign: 'right',
fontFamily: this.fonttext }}>{this.location}</Text>
<View style={{ alignItems: 'center',
justifyContent: 'center',
marginTop: (height / 3 + 10) / 11 }}>
<Text style={{ fontSize: height / 49,
fontWeight: 'bold',
color: this.state.fontColor,
textAlign: 'right',
fontFamily: this.fonttext }}>From</Text>
<Text style={{ fontSize: height / 49,
color: this.state.fontColor,
textAlign: 'right',
fontFamily: this.fonttext }}>{this.fromD}</Text>
</View>
<Text style={{ fontSize: height / 55,
color: this.state.fontColor,
textAlign: 'right',
fontFamily: this.fonttext }}>{'*' + this.notes}</Text>
</View>
</ImageBackground>
it works fine on Iphone 6
But on Iphone x, 8 plus and on android devices the view changes and the background image have some margin from above as well as from left though i have used Dimensions so i can get the height and the width of the screen so i can set the view accordingly but didn't work so what is the best thing to do in this scenario so the view will be the same on all devices.