-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
62 lines (54 loc) · 1.77 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
import React from 'react';
import { LogBox } from 'react-native';
// Change default font to Monserrat.
import AppLoading from 'expo-app-loading';
import {
useFonts,
Montserrat_400Regular,
Montserrat_400Regular_Italic,
Montserrat_600SemiBold,
Montserrat_600SemiBold_Italic,
Montserrat_700Bold,
Montserrat_700Bold_Italic,
} from '@expo-google-fonts/montserrat';
// Internal components.
import Start from './components/Start';
import Chat from './components/Chat';
// Native-Driven gesture management for improved touch-based experiences.
import 'react-native-gesture-handler';
// Routing and navigation for Expo and React Native apps.
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
const Stack = createStackNavigator();
// Ignore error and warning alerts inside the app (show only in the console).
LogBox.ignoreAllLogs();
export default function App() {
// Select the fonts to use.
let [fontsLoaded] = useFonts({
Regular: Montserrat_400Regular,
RegularI: Montserrat_400Regular_Italic,
SemiBold: Montserrat_600SemiBold,
SemiBoldI: Montserrat_600SemiBold_Italic,
Bold: Montserrat_700Bold,
BoldI: Montserrat_700Bold_Italic,
});
// Catch font loading errors.
if (!fontsLoaded) {
return <AppLoading />;
}
return (
<NavigationContainer>
<Stack.Navigator initialRouteName='miniChat'>
<Stack.Screen name='miniChat' component={Start} />
<Stack.Screen
name='Chat'
component={Chat}
// Pass route prop as argument to the screen to set component title.
options={({ route }) => ({
title: `${route.params.name}'s Chat`,
})}
/>
</Stack.Navigator>
</NavigationContainer>
);
}