React-native-google-places-autocomplete: Element type is invalid

Created on 21 Sep 2017  路  5Comments  路  Source: FaridSafi/react-native-google-places-autocomplete

Everything was working fine, but now I'm getting this error when I try to type input.
Also getting a warning about getInitialState which is in the package code.

screen shot 2017-09-21 at 1 52 30 pm


import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';

<GooglePlacesAutocomplete
          placeholder={'search'}
          minLength={2}
          autoFocus={false}
          returnKeyType={'search'}
          fetchDetails={true}
          onPress={(data, details) => {
            const lat = details.geometry.location.lat;
            const lng = details.geometry.location.lng;
            const coords = {
              lat: lat,
              lng: lng
            };
            this.setState({ lat: lat, lng: lng });
          }}
          query={{
            key: private,
            language: 'en',
          }}
          GooglePlacesSearchQuery={{
            rankby: 'distance',
            types: 'geocode'
           }}
          filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']}
          debounce={200}
          keyboardShouldPersistTaps="always"
          renderLeftButton={() => <Image source={search} />}
          styles={{
            textInputContainer: {
              height: 40,
              backgroundColor: '#181818',
              borderTopWidth: 0,
              marginLeft: 10,
              marginRight: 10,
              alignItems: 'center'
            },
            description: {
              color: 'white'
            },
            textInput: {
              height: 40,
              color: '#E1E1E5',
              paddingBottom: 15,
              backgroundColor: 'transparent',
              borderBottomWidth: 1,
              borderBottomColor: 'grey',
              // color: '#5d5d5d',
              fontSize: 16
            },
            poweredContainer: {
              backgroundColor: 'transparent'
            }
          }}
        />

Im using RN 0.42

help wanted

All 5 comments

@mbelgrader We'll need more informations to help you. Can you show some more code? How did you import GooglePlacesAutocomplete?

Exactly, we need more info. Just ran your snippet and it was working fine.

@mbelgrader your are missing a comma.
``` query={{
key: private
language: 'en',
}}



```          query={{
            key: private,       // Forgot comma
            language: 'en',
          }}

Edit:
I now face your issue of the typing in the input, but the missing comma was an issue.
I also receive an issue about getInitialState

import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
....
{Code from above}

package.json

    "react": "~15.4.0-rc.4",
    "react-native": "0.41.1",
    "react-native-google-places-autocomplete": "^1.3.6",

EDIT#2

peer dependency issue on my end. downgraded to 1.2.12 and works

I have a comma there, i just deleted when deleting the key to copy paste.

Downgrading to 1.2.12 worked for me, but I'd like to use the newer version if possible.

Same issue, downgrading does not help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

biks152207 picture biks152207  路  4Comments

yashwanth15 picture yashwanth15  路  3Comments

sohel-tech picture sohel-tech  路  3Comments

KhalilKhalaf picture KhalilKhalaf  路  4Comments

tezahzulueta picture tezahzulueta  路  3Comments