Commit 6d9d699b authored by Ishini Kiridena's avatar Ishini Kiridena

Splash screen and main views

parent 3915b167
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
# macOS
.DS_Store
# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
import React, { useEffect, useState } from "react";
import { createStackNavigator } from "@react-navigation/stack";
import { NavigationContainer } from "@react-navigation/native";
import MainScreen from "./components/shared/mainview";
import SplashScreenComponent from "./components/shared/splashscreen";
const Stack = createStackNavigator();
export default function App() {
const [isReady, setIsReady] = useState(false);
useEffect(() => {
setTimeout(() => {
setIsReady(true);
}, 3000); // Change the duration as needed
}, []);
return (
<NavigationContainer>
{isReady ? (
<Stack.Navigator>
<Stack.Screen
name="MainScreen"
component={MainScreen}
options={{ headerShown: false }}
/>
</Stack.Navigator>
) : (
<SplashScreenComponent />
)}
</NavigationContainer>
);
}
// export default function App() {
// return (
// <View style={styles.container}>
// <Text>Open up App.js to start working on your app!</Text>
// <StatusBar style="auto" />
// </View>
// );
// }
// const styles = StyleSheet.create({
// container: {
// flex: 1,
// backgroundColor: "#fff",
// alignItems: "center",
// justifyContent: "center",
// },
// });
{
"expo": {
"name": "emma-frontend",
"slug": "emma-frontend",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
import React from "react";
import { StyleSheet, View, Text, Button } from "react-native";
const MainScreen = () => {
return (
<View style={styles.container}>
<View style={styles.buttonContainer}>
<Button title="Login" onPress={() => console.log("Login")} />
<View style={styles.separator} />
<Button title="Register" onPress={() => console.log("Register")} />
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
buttonContainer: {
flexDirection: "row",
marginVertical: 20,
},
separator: {
width: 10,
},
});
export default MainScreen;
import { Image, StyleSheet, View } from "react-native";
import React from "react";
const SplashScreenComponent = () => {
return (
<View style={styles.container}>
<Image
source={require("./../../assets/logo.png")}
style={styles.logo}
></Image>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#FFFFFF",
justifyContent: "center",
alignItems: "center",
},
logo: {
width: 200,
height: 200,
},
});
export default SplashScreenComponent;
This diff is collapsed.
{
"name": "emma-frontend",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@react-navigation/native": "^6.1.6",
"@react-navigation/stack": "^6.3.16",
"expo": "~48.0.15",
"expo-status-bar": "~1.4.4",
"react": "18.2.0",
"react-native": "0.71.7"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment