-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSplashScreenView.js
50 lines (45 loc) · 1.19 KB
/
SplashScreenView.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import React from "react";
import {
Image,
StyleSheet,
Text,
View,
Dimensions,
PixelRatio,
} from "react-native";
import Icon from "./assets/icon.png";
const { width, height } = Dimensions.get("window");
const responsiveWidth = (percent) => {
return PixelRatio.roundToNearestPixel((width * percent) / 100);
};
const responsiveHeight = (percent) => {
return PixelRatio.roundToNearestPixel((height * percent) / 100);
};
export default function SplashScreen() {
return (
<View style={styles.container}>
<Image source={Icon} style={styles.image} />
<Text style={styles.text}>Home Service App</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
image: {
width: responsiveWidth(25), // 25% of the screen width
height: responsiveWidth(25), // Maintain aspect ratio
resizeMode: "cover",
borderRadius: responsiveWidth(12.5), // 50% of image width for a circle
},
text: {
fontSize: responsiveWidth(6), // Responsive text size
fontWeight: "bold",
marginTop: responsiveHeight(2),
marginBottom: responsiveHeight(2),
},
});