|
@@ -1,23 +1,15 @@
|
|
|
-import React, { useState, useEffect, Children } from 'react';
|
|
|
-import { View, Text, StatusBar, StyleSheet, Dimensions, Button, ActivityIndicator, Alert, Modal, PanResponderCallbacks, PanResponderGestureState, GestureResponderEvent, ImageSourcePropType, TouchableOpacity, Platform, Linking, Pressable, } from 'react-native';
|
|
|
-import { Svg, Defs, Rect, Mask, Circle, Marker, Path, Polyline, Image } from 'react-native-svg';
|
|
|
-import { RadioButton } from 'react-native-paper';
|
|
|
-import { Picker as EricPicker } from '@react-native-picker/picker';
|
|
|
-import ReactNativeZoomableView from '@openspacelabs/react-native-zoomable-view/src/ReactNativeZoomableView';
|
|
|
-import Spinner from 'react-native-spinkit'
|
|
|
-import { colors, lmTypesIndoor } from "../../../utils/GlobalUtils";
|
|
|
-import { MapStackNavigationProp } from "../../../navigation/MapNavigator"
|
|
|
-import CustomModal from './modal';
|
|
|
import { FontAwesome } from "@expo/vector-icons";
|
|
|
-import ReactDOMServer from 'react-dom/server'; //npm i --save-dev @types/react-dom
|
|
|
-import { ZoomableViewEvent } from '@openspacelabs/react-native-zoomable-view/src/typings';
|
|
|
-import IndoorFloor from '../IndoorFloor'
|
|
|
-// import Toast from 'react-native-toast-message';
|
|
|
-import Toast from 'react-native-root-toast';
|
|
|
-import ArrowButton from './ArrowButton'
|
|
|
-import BottomButtons from './BottomButtons'
|
|
|
+import ReactNativeZoomableView from '@openspacelabs/react-native-zoomable-view/src/ReactNativeZoomableView';
|
|
|
+import React, { useEffect, useState } from 'react';
|
|
|
+import { ActivityIndicator, Alert, Dimensions, GestureResponderEvent, ImageSourcePropType, StatusBar, StyleSheet, View } from 'react-native';
|
|
|
import Picker from 'react-native-picker-select';
|
|
|
+import Toast from 'react-native-root-toast';
|
|
|
+import { Image, Rect, Svg } from 'react-native-svg';
|
|
|
import { Landmark } from '../../../data/landmarks';
|
|
|
+import { MapStackNavigationProp } from "../../../navigation/MapNavigator";
|
|
|
+import { colors, lmTypesIndoor } from "../../../utils/GlobalUtils";
|
|
|
+import IndoorFloor from '../IndoorFloor';
|
|
|
+import ArrowButton from './ArrowButton';
|
|
|
|
|
|
|
|
|
|
|
@@ -32,11 +24,9 @@ interface IndoorMapProps {
|
|
|
|
|
|
|
|
|
|
|
|
-const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddLandmark, focusLandmark, applyFilter }) => {
|
|
|
+const IndoorMap: React.FC<IndoorMapProps> = ({ landmarks, promptAddLandmark, focusLandmark, applyFilter }) => {
|
|
|
const [floor, setFloor] = useState(1);
|
|
|
const [showME, setShowME] = useState(false);
|
|
|
- const [showDots, setShowDots] = useState(false);
|
|
|
- const [showAddedDot, setShowAddedDot] = useState(false)
|
|
|
const [SVGdim, setSVGdim] = useState([1, 1])
|
|
|
|
|
|
const [localLandmarks, setLocalLandmarks] = useState<Landmark[]>([])
|
|
@@ -59,8 +49,7 @@ const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddL
|
|
|
href={lmTypesIndoor[item.landmark_type].image as ImageSourcePropType} />
|
|
|
)
|
|
|
}
|
|
|
- }
|
|
|
- )
|
|
|
+ })
|
|
|
|
|
|
|
|
|
function addLandmark(evt: GestureResponderEvent) {
|
|
@@ -87,9 +76,7 @@ const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddL
|
|
|
|
|
|
useEffect(() => {
|
|
|
// Alert.alert("useEffect has been triggered")
|
|
|
- setShowAddedDot(false)
|
|
|
- setShowDots(false)
|
|
|
- setTimeout(() => setShowME(true), 100);
|
|
|
+ setTimeout(() => setShowME(true), 50);
|
|
|
})
|
|
|
|
|
|
const childToWeb = (child: any) => {
|
|
@@ -101,23 +88,6 @@ const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddL
|
|
|
};
|
|
|
|
|
|
const toWeb = (children: any) => React.Children.map(children, childToWeb);
|
|
|
-
|
|
|
- function renderSvg() {
|
|
|
- return (
|
|
|
- <Svg height="100%" width="100%" style={{ backgroundColor: '#33AAFF' }}>
|
|
|
- <Rect
|
|
|
- x="50"
|
|
|
- y="50"
|
|
|
- width="50"
|
|
|
- height="50"
|
|
|
- fill="#3399ff"
|
|
|
- strokeWidth="3"
|
|
|
- stroke="rgb(0,0,0)"
|
|
|
- />
|
|
|
- </Svg>
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
function changer(num) {
|
|
|
setFloor(prevState => prevState + num)
|
|
|
}
|
|
@@ -127,7 +97,7 @@ const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddL
|
|
|
<View style={{ height: '100%', width: Dimensions.get("screen").width, backgroundColor:colors.red }}>
|
|
|
|
|
|
<StatusBar backgroundColor={colors.red} />
|
|
|
- <CustomModal />
|
|
|
+ {/* <CustomModal /> */}
|
|
|
{/* <Text style={{ fontSize: 16, marginBottom: 5 }}>Please select a floor you would like to go to.</Text> */}
|
|
|
|
|
|
<View style={{ borderColor: "blue", borderWidth: 0, maxHeight: 50, flex: 1, flexDirection: "row", justifyContent: "center", }}>
|
|
@@ -162,23 +132,6 @@ const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddL
|
|
|
</View>
|
|
|
|
|
|
|
|
|
- {/* <EricPicker
|
|
|
- style={{ backgroundColor: colors.red, width: 200, height: 50, flex: 5, color: 'white' }}
|
|
|
- selectedValue={floor} // the text of what gets displayed on the dropdown header
|
|
|
- onValueChange={(itemValue, itemIndex: number) => {
|
|
|
- setFloor(itemIndex)
|
|
|
- setShowME(false)
|
|
|
- }}>
|
|
|
- The value in EricPicker.Item refers to selectedValue in EricPicker, which refers to the state "floor"
|
|
|
- <EricPicker.Item label="Basement" value={0} />
|
|
|
- <EricPicker.Item label="First Floor" value={1} />
|
|
|
- <EricPicker.Item label="Second Floor" value={2} />
|
|
|
- <EricPicker.Item label="Third Floor" value={3} />
|
|
|
- <EricPicker.Item label="Fourth Floor" value={4} />
|
|
|
- <EricPicker.Item label="Fifth Floor" value={5} />
|
|
|
- </EricPicker> */}
|
|
|
-
|
|
|
-
|
|
|
{/* {floor == 5 ? arrowBut(0, "") : arrowBut(1, "chevron-right")} */}
|
|
|
{floor == 5 ? <ArrowButton num={0} fontAweIcon={""} /> : <ArrowButton num={1} fontAweIcon={"chevron-right"} propEvent={() => changer(1)} />}
|
|
|
|
|
@@ -189,7 +142,7 @@ const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddL
|
|
|
<View style={styles.container}>
|
|
|
{showME === false ?
|
|
|
<View style={{ display: 'flex', flexDirection: 'row', justifyContent: "center", }}>
|
|
|
- <Spinner size={200} color={colors.red} type="9CubeGrid" />
|
|
|
+ <ActivityIndicator color={colors.red} size="large" />
|
|
|
</View> :
|
|
|
|
|
|
<ReactNativeZoomableView
|
|
@@ -227,22 +180,6 @@ const IndoorMap: React.FC<IndoorMapProps> = ({ navigation, landmarks, promptAddL
|
|
|
|
|
|
</View>
|
|
|
</View>
|
|
|
- {/* <Button title="load coordinates" onPress={() => {
|
|
|
- setfirstTime(false)
|
|
|
- setLocalLandmarks(landmarks)
|
|
|
- }} /> */}
|
|
|
-
|
|
|
- {/* <Button title='Press me to svgString' color={colors.red} onPress={serialize}></Button> */}
|
|
|
- {/* <View style={{ flex: 0.1, flexDirection: 'row', alignItems:'flex-end', justifyContent: 'space-around' , borderColor:'green' , borderWidth:0 ,}}>
|
|
|
- <Button title="Go back to map" color={colors.red} onPress={() => navigation.goBack()} />
|
|
|
- <Button title="Resources" color={colors.red} onPress={() => Linking.openURL('https://www.library.ualberta.ca/')} />
|
|
|
- </View> */}
|
|
|
- {/* <TouchableOpacity style={styles.arrowButton} onPress={() => setFloor(prevState => prevState+1)} ><Text>Increase floor by 1</Text></TouchableOpacity> */}
|
|
|
-
|
|
|
-
|
|
|
- {/* <BottomButtons navigation={navigation}/> */}
|
|
|
- {/* <Text>{floor}</Text> */}
|
|
|
-
|
|
|
</View >
|
|
|
);
|
|
|
}
|
|
@@ -256,12 +193,6 @@ const styles = StyleSheet.create({
|
|
|
borderWidth: 0,
|
|
|
marginVertical: 0,
|
|
|
aspectRatio: 8 / 10, // (caters to portrait mode) (width is 80% the value of height dimension)
|
|
|
- // flex: 1,
|
|
|
- // // backgroundColor: "#fff",
|
|
|
- // justifyContent: "center",
|
|
|
- // borderColor: "black",
|
|
|
- // borderWidth: 2,
|
|
|
- // marginVertical: 15,
|
|
|
width: '100%',
|
|
|
height: '100%',
|
|
|
maxWidth: "100%",
|
|
@@ -280,9 +211,7 @@ const styles = StyleSheet.create({
|
|
|
arrowButton: {
|
|
|
flex: 1,
|
|
|
backgroundColor: colors.red,
|
|
|
- // backgroundColor: "blue",
|
|
|
height: 53.5,
|
|
|
- // borderRadius: 10,
|
|
|
},
|
|
|
});
|
|
|
|