-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
90 lines (83 loc) · 2.89 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
import React from "react";
import {Platform } from "react-native";
import { enableScreens } from 'react-native-screens';
import { NavigationContainer } from "@react-navigation/native";
import { Ionicons } from '@expo/vector-icons';
import { createNativeStackNavigator } from 'react-native-screens/native-stack';
import { OverflowMenuProvider } from 'react-navigation-header-buttons';
import {
HeaderButtons,
HeaderButton,
Item,
OverflowMenu,
HiddenItem,
} from 'react-navigation-header-buttons';
import { HomeScreen, BlocklyScreen, areaCoverageScreen } from "./helpers/Helper";
import { getCode, refreshWebView, clearBlocklyWorkspace } from "./screens/BlocklyPage";
import { BlurView } from 'expo-blur';
enableScreens();
//const Stack = createStackNavigator();
const Stack = createNativeStackNavigator();
const IoniconsHeaderButton = (props) => (
// the `props` here come from <Item ... />
// you may access them and pass something else to `HeaderButton` if you like
<HeaderButton {...props} IconComponent={Ionicons} iconSize={23} color="midnightblue" />
);
export default (App) => {
return (
<NavigationContainer>
<OverflowMenuProvider>
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerLargeTitle: true,
headerHideShadow: true,
//headerStyle: {backgroundColor: "#ffab24"},
//headerTintColor: "white"
}}>
<Stack.Screen
name="Home"
component={HomeScreen}
options={{
title: "Dashboard",
headerTransparent: true,
headerBackground: () => (
<BlurView
tint="dark"
intensity={100}
style={StyleSheet.absoluteFill}
/>
),
}}
/>
<Stack.Screen
name="Blockly"
component={BlocklyScreen}
options={{
headerRight: () => (
<HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}>
<Item title="build" iconName={Platform.OS == 'android' ? "md-build" : "ios-build"} onPress={getCode} />
<OverflowMenu
style={{
marginHorizontal: 10,
//marginRight: -5,
}}
OverflowIcon={<Ionicons name={Platform.OS == 'android' ? "md-more" : "ios-more"} size={23} color="midnightblue" />}
>
<HiddenItem title="Aggiorna" onPress={refreshWebView} />
<HiddenItem title="Pulisci workspace" onPress={clearBlocklyWorkspace}/>
</OverflowMenu>
</HeaderButtons>
),
}}
/>
<Stack.Screen
name="areaCoverageScreen"
component={areaCoverageScreen}
options={{ title: "Area Coverage Algorithms" }}
/>
</Stack.Navigator>
</OverflowMenuProvider>
</NavigationContainer>
);
};