-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
152 lines (142 loc) · 4.41 KB
/
App.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// App.js
import React, { useEffect, useRef, useState } from "react";
import { NavigationContainer, useNavigation } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { Image, StyleSheet, Text, View } from "react-native";
import HomeScreen from "./screens/HomeScreen";
import BarcodeGenerator from "./screens/BarcodeGeneratorScreen";
import BarcodeScanners from "./screens/BarcodeScannerScreen";
import ScannedDataScreen from "./screens/ScannedDataScreen";
import NewBill from "./components/NewBill";
import Login from "./screens/Login";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import Toast from "react-native-toast-message";
import toastConfig from "./utils/customToastConfig";
import NewBillScreen from "./screens/NewBillScreen";
import * as Animatable from "react-native-animatable";
import { StatusBar } from "expo-status-bar";
import OrderTable from "./screens/OrderTable";
import NewOrder from "./components/NewOrder";
import NewOrderScreen from "./screens/NewOrderScreen";
import { Provider as PaperProvider } from 'react-native-paper';
// Automatically import all screen components
// const screens = require.context('./screens', true, /\.js$/);
const Stack = createNativeStackNavigator();
function HomeHeaderRight() {
const navigation = useNavigation();
return (
<Icon
name="logout-variant"
size={28}
color="black"
onPress={() => {
navigation.navigate("Login");
Toast.show({
type: "success",
text1: "Logout successful!",
});
}}
/>
);
}
const SplashScreen = () => (
<View style={styles.container}>
<Animatable.View
animation="pulse"
easing="ease-out"
iterationCount="infinite"
style={styles.iconContainer}
>
<Icon name="barcode-scan" size={100} color={"#0A8ADC"} />
</Animatable.View>
{/* <Image source={require('./src/assets/logo.png')} style={styles.image} /> */}
</View>
);
export default function App() {
const [splashVisible, setSplashVisible] = useState(true);
useEffect(() => {
setTimeout(() => {
setSplashVisible(false);
}, 2000); // Change the duration as needed
}, []);
return splashVisible ? (
<SplashScreen />
) : (
<>
<PaperProvider>
<StatusBar style="auto" />
<NavigationContainer>
<Stack.Navigator initialRouteName="Login">
<Stack.Screen
name="Home"
component={HomeScreen}
options={{
headerTitle: "Welcome",
headerLeft: () => <Text></Text>,
headerRight: () => <HomeHeaderRight />,
}}
/>
<Stack.Screen
name="BarcodeGenerator"
component={BarcodeGenerator}
options={{ headerTitle: "Barcode Generator" }}
/>
<Stack.Screen
name="BarcodeScanner"
component={BarcodeScanners}
options={{
headerTitle: "Barcode Scanner",
headerRight: () => <NewBill />,
}}
/>
<Stack.Screen
name="ScannedData"
component={ScannedDataScreen}
options={{ headerTitle: "Scanned Data" }}
/>
<Stack.Screen
name="NewBill"
component={NewBillScreen}
options={{ headerTitle: "Create New Bill" }}
/>
<Stack.Screen
name="NewOrder"
component={NewOrderScreen}
options={{ headerTitle: "Create Order" }}
/>
<Stack.Screen
name="OrderTable"
component={OrderTable}
options={{ headerTitle: "Orders",headerRight: () => <NewOrder />, }}
/>
<Stack.Screen
name="Login"
component={Login}
options={{ headerShown: false }}
// options={{ headerTitle : "Login", headerTitleAlign : "center"}}
/>
</Stack.Navigator>
</NavigationContainer>
<Toast config={toastConfig} position="bottom" />
</PaperProvider>
</>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "white",
// backgroundColor: '#00B386',
},
image: {
width: 150,
height: 150,
resizeMode: "contain",
},
iconContainer: {
justifyContent: "center",
alignItems: "center",
},
});