-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
98 lines (96 loc) · 3.12 KB
/
App.tsx
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
import React from "react";
import Router from "./src/screens/Router";
import { AuthProvider } from "./src/utils/auth";
import "./ignoreWarnings";
import { Animated, Text, View, Easing, ActivityIndicator } from "react-native";
import { ToastProvider } from "react-native-toast-notifications";
import GetSvg from "./src/utils/GetSvg";
import { StripeProvider } from "@stripe/stripe-react-native";
import ApiConfig from "./src/constants/ApiConfig";
import { Provider } from "react-redux";
import store from "./src/redux/store";
import { useIsLoading } from "./src/utils/useReduxUtil";
import Loading from "./src/components/atoms/Loading";
export default function App() {
const switchIcon = (type: string) => {
switch (type) {
case "success":
return (
<View className="w-5 h-5 justify-center items-center rounded-full bg-[#61d345]">
<GetSvg
name={"tickIcon"}
classN="w-4 h-4"
color="white"
pathStrokeWidth={3}
/>
</View>
);
case "error":
return (
<View className="w-5 h-5 justify-center items-center rounded-full bg-[#d10000]">
<GetSvg
name={"closeWithoutCircleIcon"}
classN="w-3 h-3"
color="white"
pathStrokeWidth={2.5}
/>
</View>
);
case "warning":
return (
<View className="w-5 h-5 justify-center items-center rounded-full bg-[#f59e0b]">
<GetSvg
name={"warningIcon"}
classN="w-5 h-5"
color="white"
pathStrokeWidth={0.5}
/>
</View>
);
default:
return null;
}
};
return (
<React.Fragment>
<Provider store={store}>
<StripeProvider
publishableKey={ApiConfig.STRIPE_KEY}
threeDSecureParams={{
backgroundColor: "#d10000",
}}
>
<ToastProvider
placement="bottom"
duration={2000}
animationType="slide-in"
successColor="#16a34a"
animationDuration={500}
swipeEnabled={true}
offsetBottom={90}
renderToast={(toastOptions) => (
<View className="bg-white w-fit max-w-[80%] p-1 -z-50 h-fit rounded-full border border-gray-200 flex flex-row ">
<View className=" max-w-[10%] h-full justify-center items-center">
{switchIcon(toastOptions.type ?? "")}
</View>
<View className="justify-center max-w-[90%] p-1 items-start mx-1 text-center">
<Text
className="text-black font-bold text-center font-poppins"
adjustsFontSizeToFit={true}
>
{toastOptions.message}{" "}
</Text>
</View>
</View>
)}
>
<Loading />
<AuthProvider>
<Router />
</AuthProvider>
</ToastProvider>
</StripeProvider>
</Provider>
</React.Fragment>
);
}