瀏覽代碼

GooglePlacesAutocomplete props fix

Viktoriia 1 周之前
父節點
當前提交
8c0c4b0478

+ 2 - 0
src/screens/InAppScreens/TravelsScreen/Components/AddMapPinModal/index.tsx

@@ -13,6 +13,7 @@ import {
 } from 'react-native-google-places-autocomplete';
 import MapView, { Marker } from 'react-native-maps';
 import axios from 'axios';
+import { GooglePlacesAutocompleteDefaultProps } from '../../SuggestSeriesScreen/GooglePlacesAutocompleteProps';
 
 const AddMapPinModal = () => {
   const mapRef = useRef<MapView>(null);
@@ -140,6 +141,7 @@ const AddMapPinModal = () => {
 
         <View style={styles.searchContainer}>
           <GooglePlacesAutocomplete
+            {...GooglePlacesAutocompleteDefaultProps}
             placeholder="Find a spot"
             onPress={handlePlaceSelection}
             query={{

+ 47 - 0
src/screens/InAppScreens/TravelsScreen/SuggestSeriesScreen/GooglePlacesAutocompleteProps.ts

@@ -0,0 +1,47 @@
+import { GooglePlacesAutocompleteProps } from 'react-native-google-places-autocomplete';
+
+export const GooglePlacesAutocompleteDefaultProps: GooglePlacesAutocompleteProps = {
+  autoFillOnNotFound: false,
+  currentLocation: false,
+  currentLocationLabel: 'Current location',
+  debounce: 0,
+  disableScroll: false,
+  enableHighAccuracyLocation: true,
+  enablePoweredByContainer: true,
+  fetchDetails: false,
+  filterReverseGeocodingByTypes: [],
+  GooglePlacesDetailsQuery: {},
+  GooglePlacesSearchQuery: {
+    rankby: 'distance',
+    type: 'restaurant',
+  },
+  GoogleReverseGeocodingQuery: {},
+  isRowScrollable: true,
+  keyboardShouldPersistTaps: 'always',
+  listHoverColor: '#ececec',
+  listUnderlayColor: '#c8c7cc',
+  listViewDisplayed: 'auto',
+  keepResultsAfterBlur: false,
+  minLength: 0,
+  nearbyPlacesAPI: 'GooglePlacesSearch',
+  numberOfLines: 1,
+  onFail: () => {},
+  onNotFound: () => {},
+  onPress: () => {},
+  onTimeout: () => console.warn('google places autocomplete: request timeout'),
+  placeholder: '',
+  predefinedPlaces: [],
+  predefinedPlacesAlwaysVisible: false,
+  query: {
+    key: 'missing api key',
+    language: 'en',
+    types: 'geocode',
+  },
+  styles: {},
+  suppressDefaultStyles: false,
+  textInputHide: false,
+  textInputProps: {},
+  timeout: 20000,
+  isNewPlacesAPI: false,
+  fields: '*',
+};

+ 3 - 1
src/screens/InAppScreens/TravelsScreen/SuggestSeriesScreen/index.tsx

@@ -39,6 +39,7 @@ import SeriesSelector from './SeriesSelector';
 import SearchIcon from 'assets/icons/search.svg';
 import InfoIcon from 'assets/icons/info-solid.svg';
 import Tooltip from 'react-native-walkthrough-tooltip';
+import { GooglePlacesAutocompleteDefaultProps } from './GooglePlacesAutocompleteProps';
 
 interface Series {
   id: number;
@@ -190,6 +191,7 @@ const SuggestSeriesScreen = ({ navigation }: { navigation: any }) => {
       style={{
         height: '100%'
       }}
+      edges={['top']}
     >
       <View style={styles.wrapper}>
         <Header
@@ -225,6 +227,7 @@ const SuggestSeriesScreen = ({ navigation }: { navigation: any }) => {
         />
         <View style={styles.searchContainer}>
           <GooglePlacesAutocomplete
+            {...GooglePlacesAutocompleteDefaultProps}
             placeholder="Add a landmark"
             onPress={handlePlaceSelection}
             query={{
@@ -414,7 +417,6 @@ const SuggestSeriesScreen = ({ navigation }: { navigation: any }) => {
                       itemVisiblePercentThreshold: 50,
                       minimumViewTime: 1000
                     }}
-                    estimatedItemSize={40}
                     data={groupedSeries}
                     renderItem={renderGroup}
                     keyExtractor={(item) => item.title}