diff --git a/app/index.tsx b/app/index.tsx index 54ab226..ac7854e 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -2,6 +2,7 @@ import React from 'react'; import {View, Text } from "react-native"; import { useTheme } from "react-native-paper"; import Profile from "@/components/Profile"; +import LocationScreen from "@/components/Location"; import Status from "@/components/Status"; import TopNav from "@/components/TopNav"; import DrawerMenu from "@/components/DrawerMenu"; @@ -63,11 +64,9 @@ const Index = () => { aboutVisible={isAboutActive} privacyVisible={isPrivacyActive} bugVisible={isBugActive} - locationVisible={isLocationActive} toggleAbout={() => setAboutActive(!isAboutActive)} togglePrivacy={() => setPrivacyActive(!isPrivacyActive)} toggleBug={() => setBugActive(!isBugActive)} - toggleLocation={() => setLocationActive(!isLocationActive)} /> setMenuActive(!isMenuActive)} @@ -94,6 +93,13 @@ const Index = () => { setChanged={setUserDataChanged} onClose={() => setProfileActive(false)} /> + setLocationActive(false)} + /> ); }; diff --git a/components/Dialogs.tsx b/components/Dialogs.tsx index fd6f482..7817ee6 100644 --- a/components/Dialogs.tsx +++ b/components/Dialogs.tsx @@ -3,20 +3,18 @@ import { Portal, Button, Dialog, useTheme } from "react-native-paper"; import About from "@/components/About"; import Privacy from "@/components/Privacy"; import Broken from "@/components/Broken"; -import Location from "@/components/Location"; + interface DialogsProps { aboutVisible: boolean; privacyVisible: boolean; bugVisible: boolean; - locationVisible: boolean; toggleAbout: () => void; togglePrivacy: () => void; toggleBug: () => void; - toggleLocation: () => void; } -const Dialogs: React.FC = ({ aboutVisible, privacyVisible, bugVisible, locationVisible, toggleAbout, togglePrivacy, toggleBug, toggleLocation }) => { +const Dialogs: React.FC = ({ aboutVisible, privacyVisible, bugVisible, toggleAbout, togglePrivacy, toggleBug }) => { const theme = useTheme(); return ( @@ -56,18 +54,6 @@ const Dialogs: React.FC = ({ aboutVisible, privacyVisible, bugVisi - toggleLocation()} - style={{backgroundColor: theme.colors.primaryContainer}}> - Location - - - - - ) } diff --git a/components/Location.tsx b/components/Location.tsx index f7c2e33..0672ae3 100644 --- a/components/Location.tsx +++ b/components/Location.tsx @@ -1,11 +1,19 @@ import React, { useState } from "react"; -import { Dialog, TextInput, useTheme, Button, Text, List } from "react-native-paper"; +import {Dialog, TextInput, useTheme, Button, Text, List, Portal} from "react-native-paper"; import { View, FlatList } from "react-native"; import Slider from "@react-native-community/slider"; import axios from "axios"; import * as Location from "expo-location"; import log from "@/util/log"; +interface LocationScreenProps { + visible: boolean; + setChanged: (dataChanged: boolean) => void; + setTheme: (theme: string) => void; + currentTheme: string; + onClose: () => void; +} + export const API_URL = process.env.EXPO_PUBLIC_API_URL; const BUTTON_WIDTH = 260; @@ -20,7 +28,7 @@ type Park = { }; }; -const LocationComponent = () => { +const LocationScreen: React.FC = ({ visible, setTheme, currentTheme, setChanged, onClose }) => { const theme = useTheme(); const [zip, setZip] = useState(""); const [distance, setDistance] = useState(25); @@ -99,102 +107,103 @@ const LocationComponent = () => { ); return ( - - - - OR - + { + onClose(); }} - > - - - - - - Distance: {distance} mile{distance !== 1 ? "s" : ""} - - - - {/* Parks List */} - {hasSearched && ( - - - Nearby Dogparks - - {parks != null ? ( - String(idx)} - renderItem={renderItem} - showsVerticalScrollIndicator={false} - style={{ maxHeight: 170 }} + style={{ backgroundColor: theme.colors.background }}> + Location + + + + OR + + - ) : ( - - No parks found in range. + + + + + Distance: {distance} mile{distance !== 1 ? "s" : ""} + + + {/* Parks List */} + {hasSearched && ( + + + Nearby Dogparks + + {parks != null ? ( + String(idx)} + renderItem={renderItem} + showsVerticalScrollIndicator={false} + style={{ maxHeight: 170 }} + /> + ) : ( + + No parks found in range. + + )} + )} - )} - - + + + ); }; -export default LocationComponent; +export default LocationScreen;