Untitled
unknown
plain_text
a year ago
3.4 kB
1
Indexable
Never
import React, { useEffect, useState } from "react"; import { StyleSheet, Text, View, useWindowDimensions, Image, TouchableOpacity, PermissionsAndroid, } from "react-native"; import normalize from "react-native-normalize"; import AsyncStorage from "@react-native-async-storage/async-storage"; // import object font import { DataFont } from "../../config/FontFamily"; export default function SplashScreen({ navigation }) { const windowWidth = useWindowDimensions().width; const windowHeight = useWindowDimensions().height; // end get location useEffect(() => { checkSession(); return () => {}; }, []); const checkSession = async () => { // navigation.replace('Home'); let data = await AsyncStorage.getItem("status_user"); if (data != null && data != "") { if (data == 1) { setTimeout(() => { navigation.replace("Home"); // navigation.navigate("InstanOrderViewPerType"); }, 100); } else if (data == 2) { setTimeout(() => { navigation.replace("PendaftaranUsaha"); }, 100); } } }; return ( <View style={{ flex: 1 }}> <View style={{ width: windowWidth, height: windowHeight * 0.14, backgroundColor: "white", }} ></View> <View style={{ flex: 1, backgroundColor: "white", justifyContent: "center", alignItems: "center", }} > <Image style={{ width: windowWidth * 0.9, height: windowWidth * 0.9, }} source={require("../../assets/images/Logo/logo_white.png")} /> </View> <View style={{ flex: 1, backgroundColor: "white", alignItems: "center", // justifyContent:"center" }} > <Text allowFontScaling={false} style={{ fontSize: normalize(26), fontFamily: `${DataFont.tujuhratus}`, color: "#2E3E5C", }} > Mulai Berjualan </Text> <View style={{ padding: 10, }} ></View> <Text allowFontScaling={false} style={{ fontSize: normalize(20), fontFamily: `${DataFont.delapan}`, color: "#7d8091", paddingHorizontal: 40, textAlign: "center", lineHeight: normalize(28), }} > Sistem Pemesanan Katalog Digital </Text> <View style={{ padding: 20, }} ></View> <TouchableOpacity style={{ alignItems: "center", backgroundColor: "#4AB363", padding: 10, paddingVertical: 16, borderRadius: 50, width: windowWidth * 0.9, height: "auto", }} onPress={() => { // navigation.replace("Login"); }} > <Text allowFontScaling={false} style={{ color: "white", fontSize: normalize(DataFont.font_size_button), fontFamily: `${DataFont.tujuhratus}`, }} > Mulai </Text> </TouchableOpacity> </View> </View> ); } const styles = StyleSheet.create({});