Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Splash and Welcome screens #20

Merged
merged 6 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions SpashScreen/Splash.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Loading from "@/app/spinner/Loading";
import { Image, StyleSheet, Text, View } from "react-native";



export default function SplashScreen(){
return (
<>
<View style={styles.container}>
<View style={styles.splash}>
<View>
<View>
<Image source={require('../assets/images/icon.png')}/>
</View>
</View>

<View>
<Text style={styles.text}>Medica</Text>
</View>
<View style={styles.spin}>
<Loading/>
</View>


</View>

</View>
</>
)
}

const styles = StyleSheet.create({
container:{
flex:1,
justifyContent:'center',
alignItems:'center',
backgroundColor:'#ffff'
},
splash:{
flex:1,
flexDirection:'row',
justifyContent:'center',
alignItems:'center',
backgroundColor:'white',
gap:20,
width:'100%'
},
text:{
fontSize:30
},
spin:{
position:'absolute',
bottom: 50

}
})
6 changes: 1 addition & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"userInterfaceStyle": "dark",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},

"assetBundlePatterns": [
"**/*"
],
Expand Down
63 changes: 60 additions & 3 deletions app/(app)/HomeScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
interface Props {}
import { Image, ScrollView, StyleSheet, Text, View } from "react-native";
import Typography from "@/constants/Typography";
import Colors from "@/constants/Colors";

export default function HomeScreen({}: Props) {
return <></>;

export default function HomeScreen(){
return (
<>
<View style={styles.container}>

<View style={styles.image}>
<Image source={require('../../assets/images/Group.png')} style={styles.imagex}/>
</View>

<View>
<Text style={styles.text}>Welcome to Medica! 👋</Text>
<Text style={styles.description}>The best online doctor appointment & consultation app of the century for your health and medical needs!</Text>
</View>


</View>

</>
)
}

const styles = StyleSheet.create({
container:{
flex:1,
justifyContent:'center',
alignItems:'center',
backgroundColor:'#ffff',
paddingTop:50,
paddingBottom:70
},

text:{
fontSize:40,
textAlign:'center',
paddingLeft:30,
paddingRight:30,
color:'#236bfd',
fontFamily:'Bold',
},
description:{
textAlign:'center',
lineHeight:25,
paddingBottom:30,
paddingTop:20,
fontFamily:'Regular',
color:Colors.light.text,
fontSize:17
},
image:{
// width: '100%',
objectFit:'cover',
height:'70%'
},
imagex:{
height:'100%'
}
})
61 changes: 61 additions & 0 deletions app/Onboading/OnboardingScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Image, ScrollView, StyleSheet, Text, View } from "react-native";
import Typography from "@/constants/Typography";
import Colors from "@/constants/Colors";


export default function OnboardingScreen(){
return (
<>
<View style={styles.container}>
<Text>OnboardingScreen</Text>
</View>
</>
)
}

const styles = StyleSheet.create({
container:{
flex:1,
justifyContent:'center',
alignItems:'center',
backgroundColor:'#ffff',
// paddingTop:80
},
splash:{
flex:1,

justifyContent:'center',
alignItems:'center',
backgroundColor:'white',
gap:20,
width:'100%',
resizeMode:'cover',


},
text:{
fontSize:40,
textAlign:'center',
paddingLeft:30,
paddingRight:30,
color:'#236bfd',
fontFamily:'Bold',
},
textx:{
textAlign:'center',
lineHeight:25,
paddingBottom:30,
paddingTop:20,
fontFamily:'Regular',
color:Colors.light.text,
fontSize:17
},
image:{
// width: '100%',
objectFit:'cover',
height:'70%'
},
imagex:{
height:'100%'
}
})
7 changes: 3 additions & 4 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ import { useEffect, useState } from "react";
import { useColorScheme } from "@/components/useColorScheme";

export {
// Catch any errors thrown by the Layout component.

ErrorBoundary,
} from "expo-router";

export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.

initialRouteName: "(auth)",
};

// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();

export default function RootLayout() {
Expand All @@ -34,7 +33,6 @@ export default function RootLayout() {
...FontAwesome.font,
});

// Expo Router uses Error Boundaries to catch errors in the navigation tree.
useEffect(() => {
if (error) throw error;
}, [error]);
Expand All @@ -59,6 +57,7 @@ function RootLayoutNav() {
<ThemeProvider value={colorScheme === "light" ? DarkTheme : DefaultTheme}>
<Stack initialRouteName="(auth)">
<Stack.Screen name="(auth)" options={{ headerShown: false }} />
<Stack.Screen name="index" options={{ headerShown: false }} />
<Stack.Screen name="modal" options={{ presentation: "modal" }} />
</Stack>
</ThemeProvider>
Expand Down
45 changes: 36 additions & 9 deletions app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
import { Text } from "@/components/Themed";
import { router } from "expo-router";
import { useEffect } from "react";
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import HomeScreen from './(app)/HomeScreen';
import SplashScreen from '@/SpashScreen/Splash';
import { useEffect, useState } from 'react';
import OnboardingScreen from './Onboading/OnboardingScreen';

export default function App() {
const [showSplash, setShowSplash] = useState(true);
const [showHome, setShowHome] = useState(false);
const [showOnboarding, setShowOnboarding] = useState(false);

useEffect(() => {

const splashTimeout = setTimeout(() => {
setShowSplash(false);
setShowHome(true);
}, 3000);


return () => clearTimeout(splashTimeout);
}, []);

export default function Index() {
useEffect(() => {
setTimeout(() => {
router.push("/(auth)/SignIn&SignOut/SetYourFingerPrint");
}, 2000);
});
if (showHome) {

const homeTimeout = setTimeout(() => {
setShowHome(false);
setShowOnboarding(true);
}, 5000);


return () => clearTimeout(homeTimeout);
}
}, [showHome]);

return (
<>
<Text>Onboarding Screen</Text>
{showSplash && <SplashScreen />}
{showHome && <HomeScreen />}
{showOnboarding && <OnboardingScreen />}
</>
);
}
40 changes: 40 additions & 0 deletions app/spinner/Loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import { StyleSheet, View} from 'react-native';
// import { ActivityIndicator,MD2Colors } from 'react-native-paper';

import {
BallIndicator,
BarIndicator,
DotIndicator,
MaterialIndicator,
PacmanIndicator,
PulseIndicator,
SkypeIndicator,
UIActivityIndicator,
WaveIndicator,
} from 'react-native-indicators';

const Loading = () => (
<View style={[styles.container, styles.horizontal]}>

<BallIndicator animating={true} color={'#236bfd'}/>

</View>
);

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
horizontal: {
flexDirection: 'row',
justifyContent: 'space-around',
padding: 10,
},
spiner:{
fontSize:30
}
});

export default Loading;
Binary file added assets/images/Group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading