-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathHomeScreen.js
More file actions
71 lines (66 loc) · 2.44 KB
/
HomeScreen.js
File metadata and controls
71 lines (66 loc) · 2.44 KB
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
67
68
69
70
71
import React from 'react';
import { View, StyleSheet, Image } from 'react-native';
import Screen from '../components/Screen';
import tw from 'tailwind-react-native-classnames';
import NavOptions from '../components/NavOptions';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete'
import { GOOGLE_MAP_APIKEY } from '@env'
import { useDispatch } from 'react-redux';
import { setDestination, setOrigin } from '../redux/slices/navSlice';
import NavFavourites from '../components/NavFavourites';
// const GOOGLE_MAP_APIKEY = ""
const HomeScreen = () => {
const dispatch = useDispatch()
return (
<Screen style={tw`bg-white h-full`}>
<View style={tw`p-5`}>
<Image
source={{ uri: 'https://links.papareact.com/gzs' }}
style={styles.logo}
/>
<View style={tw`mb-3`}>
<GooglePlacesAutocomplete
placeholder='Where from?'
nearbyPlacesAPI="GooglePlacesSearch"
debounce={400}
onPress={(data, details = null) => {
dispatch(setOrigin({
loaction: details.geometry.location,
description: data.description
}))
dispatch(setDestination(null))
}}
minLength={2}
fetchDetails={true}
returnKeyType={"search"}
onFail={error => console.error(error)}
query={{
key: GOOGLE_MAP_APIKEY,
language: 'en',
}}
styles={{
container: {
flex: 0,
},
textInput: {
fontSize: 15
}
}}
enablePoweredByContainer={false}
/>
</View>
<NavOptions />
<NavFavourites />
</View>
</Screen>
);
}
const styles = StyleSheet.create({
logo: {
height: 50,
width: 100,
resizeMode: 'contain',
marginBottom: 20
}
})
export default HomeScreen;