-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
56 lines (51 loc) · 1.61 KB
/
Copy pathApp.tsx
File metadata and controls
56 lines (51 loc) · 1.61 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
import React from "react";
import * as Notifications from "expo-notifications";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import HomeScreen from "./screens/HomeScreen";
import DestinationScreen from "./screens/DestinationScreen";
import { usePushbaseListeners } from "./lib/src";
import * as Linking from "expo-linking";
import { StatusBar } from "react-native";
import NotificationScreen from "./screens/NotificationScreen";
import { RootStackParamList } from "./types";
const prefix = Linking.createURL("/");
// Configure how your app will handle notification
Notifications.setNotificationHandler({
handleNotification: async () => ({
shouldShowAlert: true,
shouldPlaySound: true,
shouldSetBadge: true,
}),
});
const Stack = createStackNavigator<RootStackParamList>();
const config = {
screens: {
Home: "/", // Define default Home Screen
Destination: "destinations/:slug",
},
};
const linking = {
prefixes: [prefix],
config,
};
function MyStack() {
return (
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="Destination" component={DestinationScreen} />
<Stack.Screen name="Notifications" component={NotificationScreen} />
</Stack.Navigator>
);
}
export default function App() {
usePushbaseListeners({ enableDeepLinking: true });
return (
<>
<StatusBar animated={true} barStyle="dark-content" />
<NavigationContainer linking={linking}>
<MyStack />
</NavigationContainer>
</>
);
}