-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
61 lines (57 loc) · 1.68 KB
/
Copy pathApp.tsx
File metadata and controls
61 lines (57 loc) · 1.68 KB
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
import React, { useEffect } from "react";
import { Text, ActivityIndicator, View } from "react-native";
import { ThemeProvider } from "./src/contexts/ThemeContext";
import HomeScreen from "./src/screens/HomeScreen";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import {
useFonts,
JosefinSans_400Regular,
JosefinSans_700Bold,
} from "@expo-google-fonts/josefin-sans";
import { ConvexProvider } from "convex/react";
import { convex } from "./src/utils/convexClient";
import { FilterProvider } from "./src/contexts/FilterContext";
export default function App() {
const [fontsLoaded] = useFonts({
JosefinSans_400Regular,
JosefinSans_700Bold,
});
// Apply global font once fonts load
useEffect(() => {
if (fontsLoaded) {
const TextRender = (Text as any).render;
(Text as any).render = function (...args: any[]) {
const origin = TextRender.apply(this, args);
return React.cloneElement(origin, {
style: [{ fontFamily: "JosefinSans_400Regular" }, origin.props.style],
});
};
}
}, [fontsLoaded]);
// Simple loader while fonts are loading
if (!fontsLoaded) {
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#fff",
}}
>
<ActivityIndicator size="large" color="#5596FF" />
</View>
);
}
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<ConvexProvider client={convex}>
<ThemeProvider>
<FilterProvider>
<HomeScreen />
</FilterProvider>
</ThemeProvider>
</ConvexProvider>
</GestureHandlerRootView>
);
}