diff --git a/app/(root)/(tabs)/home.tsx b/app/(root)/(tabs)/home.tsx index 982f1a8..3fe5d63 100644 --- a/app/(root)/(tabs)/home.tsx +++ b/app/(root)/(tabs)/home.tsx @@ -16,6 +16,7 @@ import { Map } from "@/components/map"; import { RideCard } from "@/components/ride-card"; import { icons, images } from "@/constants"; import { useLocationStore } from "@/store"; +import { router } from "expo-router"; const recentRides = [ { @@ -136,7 +137,17 @@ const Home = () => { const [hasPermissions, setHasPermissions] = useState(false); const handleSignOut = () => {}; - const handleDestinationPress = () => {}; + const handleDestinationPress = (location: { + latitude: number; + longitude: number; + address: string; + }) => { + setDestinationLocation(location); + + console.log("Hello World!"); + + router.push("/(root)/find-ride"); + }; useEffect(() => { const requestLocation = async () => { diff --git a/app/(root)/find-ride.tsx b/app/(root)/find-ride.tsx new file mode 100644 index 0000000..070e2c5 --- /dev/null +++ b/app/(root)/find-ride.tsx @@ -0,0 +1,11 @@ +import { Text, View } from "react-native"; + +const FindRide = () => { + return ( + + Find Ride + + ); +}; + +export default FindRide; diff --git a/components/google-text-input.tsx b/components/google-text-input.tsx index 0ee55b7..798e403 100644 --- a/components/google-text-input.tsx +++ b/components/google-text-input.tsx @@ -1,6 +1,8 @@ -import { Text, View } from "react-native"; +import { View, Image } from "react-native"; +import { GooglePlacesAutocomplete } from "react-native-google-places-autocomplete"; -import type { GoogleInputProps } from "@/types/type"; +import { icons } from "@/constants"; +import { GoogleInputProps } from "@/types/type"; export const GoogleTextInput = ({ icon, @@ -8,10 +10,75 @@ export const GoogleTextInput = ({ containerStyles, textInputBackgroundColor, handlePress, -}: GoogleInputProps) => ( - - Google Text Input - -); +}: GoogleInputProps) => { + const googlePlacesApiKey = process.env.EXPO_PUBLIC_GOOGLE_API_KEY!; + + console.log(googlePlacesApiKey); + return ( + + { + handlePress({ + latitude: details?.geometry.location.lat!, + longitude: details?.geometry.location.lng!, + address: data.description, + }); + }} + query={{ + key: googlePlacesApiKey, + language: "en", + }} + renderLeftButton={() => ( + + + + )} + textInputProps={{ + placeholderTextColor: "gray", + placeholder: initialLocation ?? "Where do you want to go?", + }} + onFail={console.log} + /> + + ); +};