34 lines
No EOL
896 B
JavaScript
34 lines
No EOL
896 B
JavaScript
import { StyleSheet, Text, View } from 'react-native'
|
|
import React from 'react'
|
|
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
|
|
|
|
|
|
const mapApiKey = process.env.EXPO_PUBLIC_GOOGLE_PLACE_API_KEY;
|
|
|
|
const HomeSearch = ({searchedLocation}) => {
|
|
|
|
return (
|
|
<View style={{marginVertical: 10, marginHorizontal: 10, borderRadius: 5}}>
|
|
<GooglePlacesAutocomplete
|
|
placeholder='Search EV charging station'
|
|
textInputProps={{
|
|
placeholderTextColor: '#45474B'
|
|
}}
|
|
enablePoweredByContainer={false}
|
|
fetchDetails={true}
|
|
onPress={(data, details = null) => {
|
|
searchedLocation(details?.geometry?.location)
|
|
}}
|
|
query={{
|
|
key: mapApiKey,
|
|
language: 'en',
|
|
}}
|
|
onFail={error => console.error(error)}
|
|
/>
|
|
</View>
|
|
)
|
|
}
|
|
|
|
export default HomeSearch
|
|
|
|
const styles = StyleSheet.create({}) |