-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeScreen.js
66 lines (61 loc) · 2.3 KB
/
HomeScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from "react";
import { SafeAreaView, View, Image } from "react-native";
import tw from "tailwind-react-native-classnames";
import NavOptions from "../components/NavOptions";
import { GooglePlacesAutocomplete } from "react-native-google-places-autocomplete";
import { GOOGLE_MAPS_APIKEY } from '@env';
import { useDispatch } from "react-redux";
import { setDestination, setOrigin } from "../slices/navSlice";
import NavFavorites from "../components/NavFavorites";
const HomeScreen = () => {
const dispatch = useDispatch();
return (
<SafeAreaView style={tw`bg-white h-full`}>
<View style={tw`p-5`}>
<Image
style={{
width: 100,
height: 100,
resizeMode: "contain",
}}
source={{
uri: "https://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Uber_logo_2018.svg/2560px-Uber_logo_2018.svg.png",
}}
/>
<GooglePlacesAutocomplete
placeholder="Where From?"
nearbyPlacesAPI="GooglePlacesSearch"
debounce={400}
styles={{
container: {
flex: 0,
},
textinput: {
fontSize: 18,
},
}}
onPress={(data, details) => {
dispatch(
setOrigin({
location: details.geometry.location,
description: data.description,
})
);
dispatch(setDestination(null));
}}
fetchDetails={true}
returnKeyType={"search"}
enablePoweredByContainer={false}
minLength={2}
query={{
key: GOOGLE_MAPS_APIKEY,
language: "en",
}}
/>
<NavOptions />
<NavFavorites />
</View>
</SafeAreaView>
);
};
export default HomeScreen;