Refactor App component to include a splash screen and home screen; remove unused BootSplash theme and colors. Add SplashScreen and Home components.

This commit is contained in:
mansi-dev
2026-02-16 23:37:25 +05:30
parent 18fe05a718
commit 4b633fd8ff
7 changed files with 97 additions and 41 deletions

65
src/SplashScreen.tsx Normal file
View File

@@ -0,0 +1,65 @@
import React, { useEffect, useRef } from 'react';
import {
View,
Text,
StyleSheet,
Animated,
ImageBackground,
StatusBar,
} from 'react-native';
const SplashScreen: React.FC = () => {
const fadeAnim = useRef(new Animated.Value(0)).current;
useEffect(() => {
Animated.timing(fadeAnim, {
toValue: 1,
duration: 1200,
useNativeDriver: true,
}).start();
}, []);
return (
<>
<StatusBar hidden />
<ImageBackground
source={require('./assets/img/splash.png')}
style={styles.background}
resizeMode="cover" // IMPORTANT
>
<Animated.View
style={[
styles.overlay,
{
opacity: fadeAnim,
},
]}
>
{/* Optional content */}
{/* <Text style={styles.title}>Your App Name</Text> */}
</Animated.View>
</ImageBackground>
</>
);
};
export default SplashScreen;
const styles = StyleSheet.create({
background: {
flex: 1, // Full screen
width: '100%',
height: '100%',
},
overlay: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
title: {
fontSize: 24,
fontWeight: 'bold',
color: '#FFFFFF',
},
});