|
@@ -6,22 +6,20 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
import { FontAwesome } from "@expo/vector-icons";
|
|
import { FontAwesome } from "@expo/vector-icons";
|
|
-import { ImageInfo } from "expo-image-picker/build/ImagePicker.types";
|
|
|
|
|
|
+import { useNavigationState } from "@react-navigation/native";
|
|
import React, { MutableRefObject, useEffect, useState } from "react";
|
|
import React, { MutableRefObject, useEffect, useState } from "react";
|
|
-import { ActivityIndicator, FlatList, Image, ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, View } from "react-native";
|
|
|
|
|
|
+import { FlatList, Image, ScrollView, StyleSheet, Text, TextInput, View } from "react-native";
|
|
import Picker from "react-native-picker-select";
|
|
import Picker from "react-native-picker-select";
|
|
import { QueryStatus } from "react-query";
|
|
import { QueryStatus } from "react-query";
|
|
import { LMComment } from "../../../../data/comments";
|
|
import { LMComment } from "../../../../data/comments";
|
|
import { Landmark, LMPhoto } from "../../../../data/landmarks";
|
|
import { Landmark, LMPhoto } from "../../../../data/landmarks";
|
|
import { MainTabsNavigationProp } from "../../../../navigation/MainTabsNavigator";
|
|
import { MainTabsNavigationProp } from "../../../../navigation/MainTabsNavigator";
|
|
-import { lmTypes as allLmTypes , lmTypesIndoor } from "../../../../utils/GlobalUtils";
|
|
|
|
-import { IconButton, PrimaryButton } from "../../../Buttons";
|
|
|
|
-import { PhotoPicker } from "../../../PhotoPicker";
|
|
|
|
|
|
+import { lmTypes as allLmTypes, lmTypesIndoor } from "../../../../utils/GlobalUtils";
|
|
|
|
+import LandmarkTypePicker from "../../../LandmarkTypePicker";
|
|
import { Separator } from "../../../Separator";
|
|
import { Separator } from "../../../Separator";
|
|
import { CommentsContainer } from "./CommentsContainer";
|
|
import { CommentsContainer } from "./CommentsContainer";
|
|
import { LandmarkPhotos } from "./LandmarkPhotos";
|
|
import { LandmarkPhotos } from "./LandmarkPhotos";
|
|
|
|
|
|
-import { useNavigationState } from "@react-navigation/native"
|
|
|
|
|
|
|
|
|
|
|
|
interface DetailsBodyProps {
|
|
interface DetailsBodyProps {
|
|
@@ -90,30 +88,21 @@ export const DetailsBody: React.FC<DetailsBodyProps> = (props) => {
|
|
* Sub-component that renders picker for landmark types
|
|
* Sub-component that renders picker for landmark types
|
|
* @param
|
|
* @param
|
|
*/
|
|
*/
|
|
- const LandmarkTypePicker: React.FC = () => {
|
|
|
|
|
|
+ const LandmarkTypePickerContainer: React.FC = () => {
|
|
return (
|
|
return (
|
|
<View style={{flexDirection: 'row', marginBottom: 20, justifyContent: "space-between"}}>
|
|
<View style={{flexDirection: 'row', marginBottom: 20, justifyContent: "space-between"}}>
|
|
{props.updatedLandmark?.landmark_type ?
|
|
{props.updatedLandmark?.landmark_type ?
|
|
<>
|
|
<>
|
|
- <Picker
|
|
|
|
- style={{
|
|
|
|
- inputIOS: {flexDirection: 'row', color: 'white', textAlignVertical: 'center', },
|
|
|
|
- inputAndroid: {color: 'white', textAlignVertical: 'center'},
|
|
|
|
- iconContainer: {flex: 1, justifyContent: 'center', height: '100%'},
|
|
|
|
- inputIOSContainer: {},
|
|
|
|
- viewContainer: { padding: 5, elevation: 1, flex: 1, marginTop: 5},
|
|
|
|
- placeholder: {color: 'white'}}}
|
|
|
|
|
|
+ <LandmarkTypePicker
|
|
placeholder={{}}
|
|
placeholder={{}}
|
|
- Icon={() => <FontAwesome name="chevron-down" color='white' size={20} />}
|
|
|
|
- value={props.updatedLandmark?.landmark_type}
|
|
|
|
|
|
+ value={props.updatedLandmark?.landmark_type}
|
|
onValueChange={(value) => {
|
|
onValueChange={(value) => {
|
|
props.setUpdatedLandmark({...props.updatedLandmark, landmark_type: value, title: lmTypes[value].label})
|
|
props.setUpdatedLandmark({...props.updatedLandmark, landmark_type: value, title: lmTypes[value].label})
|
|
- }}
|
|
|
|
- useNativeAndroidPickerStyle={true}
|
|
|
|
|
|
+ }}
|
|
items={Object.keys(lmTypes)?.filter(icon => parseInt(icon) != props.landmark?.landmark_type).map(icon => {
|
|
items={Object.keys(lmTypes)?.filter(icon => parseInt(icon) != props.landmark?.landmark_type).map(icon => {
|
|
return (
|
|
return (
|
|
{label: lmTypes[parseInt(icon)].label.toUpperCase(), value: icon, key: icon}
|
|
{label: lmTypes[parseInt(icon)].label.toUpperCase(), value: icon, key: icon}
|
|
- )})} />
|
|
|
|
|
|
+ )})}/>
|
|
{props.updatedLandmark ? <Image style={{marginLeft: 20}} source={lmTypes[props.updatedLandmark?.landmark_type].image}/> : null}
|
|
{props.updatedLandmark ? <Image style={{marginLeft: 20}} source={lmTypes[props.updatedLandmark?.landmark_type].image}/> : null}
|
|
</>
|
|
</>
|
|
: null}
|
|
: null}
|
|
@@ -143,7 +132,7 @@ export const DetailsBody: React.FC<DetailsBodyProps> = (props) => {
|
|
<ScrollView nestedScrollEnabled={true} contentContainerStyle={{justifyContent: 'space-between'}} style={{flex: 1, marginHorizontal: 20}}>
|
|
<ScrollView nestedScrollEnabled={true} contentContainerStyle={{justifyContent: 'space-between'}} style={{flex: 1, marginHorizontal: 20}}>
|
|
{props.editingEnabled ?
|
|
{props.editingEnabled ?
|
|
<>
|
|
<>
|
|
- <LandmarkTypePicker />
|
|
|
|
|
|
+ <LandmarkTypePickerContainer />
|
|
<Separator style={{marginBottom: 20, opacity: .5}} color="lightgray" />
|
|
<Separator style={{marginBottom: 20, opacity: .5}} color="lightgray" />
|
|
<Text style={{color: 'white', marginBottom: 10}}>Description</Text>
|
|
<Text style={{color: 'white', marginBottom: 10}}>Description</Text>
|
|
{/* {console.log("*DETAILS BODY: currentRotue is " + currentRoute)} */}
|
|
{/* {console.log("*DETAILS BODY: currentRotue is " + currentRoute)} */}
|