|
@@ -4,7 +4,7 @@ import { createStackNavigator, StackNavigationProp } from "@react-navigation/sta
|
|
import { createNativeStackNavigator } from "@react-navigation/native-stack"
|
|
import { createNativeStackNavigator } from "@react-navigation/native-stack"
|
|
import { observer } from "mobx-react"
|
|
import { observer } from "mobx-react"
|
|
import React, { useEffect, useState } from "react"
|
|
import React, { useEffect, useState } from "react"
|
|
-import { Dimensions, Image, ScrollView, View } from "react-native"
|
|
|
|
|
|
+import { Alert, Dimensions, Image, ScrollView, View } from "react-native"
|
|
import { Chip } from "react-native-paper"
|
|
import { Chip } from "react-native-paper"
|
|
import { IconButton } from "../components/Buttons"
|
|
import { IconButton } from "../components/Buttons"
|
|
import IndoorMap from "../components/Map/MainMapComponent/IndoorMap"
|
|
import IndoorMap from "../components/Map/MainMapComponent/IndoorMap"
|
|
@@ -19,6 +19,11 @@ import { authStore } from "../libs/auth/AuthStore"
|
|
import { colors, lmTypes } from "../utils/GlobalUtils"
|
|
import { colors, lmTypes } from "../utils/GlobalUtils"
|
|
import { AuthTabsNavigationProp } from "./AuthorizedNavigator"
|
|
import { AuthTabsNavigationProp } from "./AuthorizedNavigator"
|
|
|
|
|
|
|
|
+import { Menu, MenuItem, MenuDivider } from 'react-native-material-menu';
|
|
|
|
+import { navigate } from "./RootNavigator"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
const MapStackNavigator = createNativeStackNavigator()
|
|
const MapStackNavigator = createNativeStackNavigator()
|
|
|
|
|
|
export type MapStackParamList = {
|
|
export type MapStackParamList = {
|
|
@@ -44,10 +49,11 @@ const MapNavigator: React.FC<MapNavigatorProps> = ({ route }) => {
|
|
|
|
|
|
// const currentRouteIndex = useNavigation().getState().routes[0].state.index
|
|
// const currentRouteIndex = useNavigation().getState().routes[0].state.index
|
|
// const currentRouteName = useNavigation().getState().routes[0].state.routeNames[currentRouteIndex]
|
|
// const currentRouteName = useNavigation().getState().routes[0].state.routeNames[currentRouteIndex]
|
|
-
|
|
|
|
const navigationState = useNavigationState(state => state)
|
|
const navigationState = useNavigationState(state => state)
|
|
const [currentRoute, setCurrentRoute] = useState<string>()
|
|
const [currentRoute, setCurrentRoute] = useState<string>()
|
|
|
|
|
|
|
|
+ const [visible, setVisible] = useState(false);
|
|
|
|
+
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
const currentRouteIndex = navigationState?.routes[0]?.state?.index
|
|
const currentRouteIndex = navigationState?.routes[0]?.state?.index
|
|
const currentRouteName = navigationState?.routes[0]?.state?.routeNames[currentRouteIndex]
|
|
const currentRouteName = navigationState?.routes[0]?.state?.routeNames[currentRouteIndex]
|
|
@@ -138,9 +144,7 @@ const MapNavigator: React.FC<MapNavigatorProps> = ({ route }) => {
|
|
setSelectedLandmarkId={mapState.setSelectedLandmarkId} />}
|
|
setSelectedLandmarkId={mapState.setSelectedLandmarkId} />}
|
|
</MapStackNavigator.Screen>
|
|
</MapStackNavigator.Screen>
|
|
|
|
|
|
- <MapStackNavigator.Screen name="Indoor" listeners={{
|
|
|
|
-
|
|
|
|
- }} >
|
|
|
|
|
|
+ <MapStackNavigator.Screen name="Indoor" >
|
|
{({ navigation }) =>
|
|
{({ navigation }) =>
|
|
<IndoorMap
|
|
<IndoorMap
|
|
navigation={navigation}
|
|
navigation={navigation}
|
|
@@ -151,15 +155,13 @@ const MapNavigator: React.FC<MapNavigatorProps> = ({ route }) => {
|
|
/>}
|
|
/>}
|
|
</MapStackNavigator.Screen>
|
|
</MapStackNavigator.Screen>
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
</MapStackNavigator.Navigator>
|
|
</MapStackNavigator.Navigator>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* Filter chips and button*/}
|
|
{/* Filter chips and button*/}
|
|
{!mapState.filterVisible && currentRoute == 'Indoor' ?
|
|
{!mapState.filterVisible && currentRoute == 'Indoor' ?
|
|
- <View style={{width:Dimensions.get("window").width*0.8 ,marginLeft:Dimensions.get("window").width*0.1, borderColor:"red" , borderWidth:0, bottom: 55, position: 'absolute', flexDirection: "row-reverse", justifyContent: 'flex-end' }}>
|
|
|
|
|
|
+ <View style={{ width: Dimensions.get("window").width * 0.8, marginLeft: Dimensions.get("window").width * 0.1, borderColor: "red", borderWidth: 0, bottom: 55, position: 'absolute', flexDirection: "row-reverse", justifyContent: 'flex-end' }}>
|
|
<IconButton size={16} color={colors.red} style={[mapStyles.filterButtonIndoor]} icon="filter" onPress={() => mapState.toggleFilter(true)} />
|
|
<IconButton size={16} color={colors.red} style={[mapStyles.filterButtonIndoor]} icon="filter" onPress={() => mapState.toggleFilter(true)} />
|
|
<ScrollView horizontal={true} contentContainerStyle={{ alignItems: 'center' }} style={{ marginHorizontal: 10, flexDirection: 'row' }}>
|
|
<ScrollView horizontal={true} contentContainerStyle={{ alignItems: 'center' }} style={{ marginHorizontal: 10, flexDirection: 'row' }}>
|
|
{mapState.onlyOwned ? <Chip avatar={(<FontAwesome name="user" size={20} color='gray' style={{ textAlign: 'center', textAlignVertical: 'center' }} />)} style={{ borderWidth: 1, borderColor: 'lightgray', marginRight: 5, marginLeft: 10 }} onClose={() => mapState.toggleOnlyOwned(false)}>My landmarks</Chip> : null}
|
|
{mapState.onlyOwned ? <Chip avatar={(<FontAwesome name="user" size={20} color='gray' style={{ textAlign: 'center', textAlignVertical: 'center' }} />)} style={{ borderWidth: 1, borderColor: 'lightgray', marginRight: 5, marginLeft: 10 }} onClose={() => mapState.toggleOnlyOwned(false)}>My landmarks</Chip> : null}
|
|
@@ -171,7 +173,7 @@ const MapNavigator: React.FC<MapNavigatorProps> = ({ route }) => {
|
|
{mapState.minLmRating > 0 ? <Chip avatar={(<FontAwesome name="star" size={20} color='gray' style={{ textAlign: 'center', textAlignVertical: 'center' }} />)} style={{ borderWidth: 1, borderColor: 'lightgray', marginLeft: 5, marginRight: 10 }} onClose={() => mapState.setMinLmRating(0)}>Minimum rating: {mapState.minLmRating}</Chip> : null}
|
|
{mapState.minLmRating > 0 ? <Chip avatar={(<FontAwesome name="star" size={20} color='gray' style={{ textAlign: 'center', textAlignVertical: 'center' }} />)} style={{ borderWidth: 1, borderColor: 'lightgray', marginLeft: 5, marginRight: 10 }} onClose={() => mapState.setMinLmRating(0)}>Minimum rating: {mapState.minLmRating}</Chip> : null}
|
|
</ScrollView>
|
|
</ScrollView>
|
|
</View>
|
|
</View>
|
|
- :
|
|
|
|
|
|
+ :
|
|
<View style={{ top: 10, marginLeft: 40, marginRight: 20, position: 'absolute', flexDirection: "row-reverse", justifyContent: 'flex-end' }}>
|
|
<View style={{ top: 10, marginLeft: 40, marginRight: 20, position: 'absolute', flexDirection: "row-reverse", justifyContent: 'flex-end' }}>
|
|
<IconButton size={20} color={colors.red} style={[mapStyles.filterButtonOutdoor]} icon="filter" onPress={() => mapState.toggleFilter(true)} />
|
|
<IconButton size={20} color={colors.red} style={[mapStyles.filterButtonOutdoor]} icon="filter" onPress={() => mapState.toggleFilter(true)} />
|
|
<ScrollView horizontal={true} contentContainerStyle={{ alignItems: 'center' }} style={{ marginHorizontal: 10, flexDirection: 'row' }}>
|
|
<ScrollView horizontal={true} contentContainerStyle={{ alignItems: 'center' }} style={{ marginHorizontal: 10, flexDirection: 'row' }}>
|
|
@@ -184,10 +186,36 @@ const MapNavigator: React.FC<MapNavigatorProps> = ({ route }) => {
|
|
{mapState.minLmRating > 0 ? <Chip avatar={(<FontAwesome name="star" size={20} color='gray' style={{ textAlign: 'center', textAlignVertical: 'center' }} />)} style={{ borderWidth: 1, borderColor: 'lightgray', marginLeft: 5, marginRight: 10 }} onClose={() => mapState.setMinLmRating(0)}>Minimum rating: {mapState.minLmRating}</Chip> : null}
|
|
{mapState.minLmRating > 0 ? <Chip avatar={(<FontAwesome name="star" size={20} color='gray' style={{ textAlign: 'center', textAlignVertical: 'center' }} />)} style={{ borderWidth: 1, borderColor: 'lightgray', marginLeft: 5, marginRight: 10 }} onClose={() => mapState.setMinLmRating(0)}>Minimum rating: {mapState.minLmRating}</Chip> : null}
|
|
</ScrollView>
|
|
</ScrollView>
|
|
</View>
|
|
</View>
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ {/* Create Hamburger icon */}
|
|
|
|
+ {currentRoute == 'Indoor' ? <></> :
|
|
|
|
+ <View style={{ top: 60, right: 20, position: 'absolute', }}>
|
|
|
|
+ <Menu
|
|
|
|
+ visible={visible}
|
|
|
|
+ anchor={<IconButton size={20} color={colors.red} style={[mapStyles.filterButtonOutdoor]} icon="bars" onPress={() => setVisible(true)} />}
|
|
|
|
+ onRequestClose={() => setVisible(false)}
|
|
|
|
+ >
|
|
|
|
+
|
|
|
|
+ <MenuItem onPress={() => {
|
|
|
|
+ setVisible(false)
|
|
|
|
+ navigate("Indoor")
|
|
|
|
+ // Alert.alert("Cameron Library")
|
|
|
|
+ }}>Cameron</MenuItem>
|
|
|
|
+
|
|
|
|
+ <MenuDivider />
|
|
|
|
+ <MenuItem disabled>More indoor maps on the way!</MenuItem>
|
|
|
|
+
|
|
|
|
+ </Menu>
|
|
|
|
+
|
|
|
|
+ {/* either "bars" or "list" */}
|
|
|
|
+ <ScrollView horizontal={true} contentContainerStyle={{ alignItems: 'center' }} style={{ marginHorizontal: 10, flexDirection: 'row' }}></ScrollView>
|
|
|
|
+ </View>
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
- {/* {!mapState.filterVisible ?
|
|
|
|
|
|
+ {/* {!mapState.filterVisible ?
|
|
<View style={{ top: 10, marginLeft: 40, marginRight: 20, position: 'absolute', flexDirection: "row-reverse", justifyContent: 'flex-end' }}>
|
|
<View style={{ top: 10, marginLeft: 40, marginRight: 20, position: 'absolute', flexDirection: "row-reverse", justifyContent: 'flex-end' }}>
|
|
<IconButton size={20} color={colors.red} style={[mapStyles.filterButton]} icon="filter" onPress={() => mapState.toggleFilter(true)} />
|
|
<IconButton size={20} color={colors.red} style={[mapStyles.filterButton]} icon="filter" onPress={() => mapState.toggleFilter(true)} />
|
|
<ScrollView horizontal={true} contentContainerStyle={{ alignItems: 'center' }} style={{ marginHorizontal: 10, flexDirection: 'row' }}>
|
|
<ScrollView horizontal={true} contentContainerStyle={{ alignItems: 'center' }} style={{ marginHorizontal: 10, flexDirection: 'row' }}>
|