question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `GooglePlacesAutocomplete`.

See original GitHub issue

Auto Complete box does not render and throws me an error. Stack Trace: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of 'GooglePlacesAutocomplete'. Code :

var {
  GooglePlacesAutocomplete
} = require('react-native-google-places-autocomplete');
import React, { Component } from 'react';
import { PLACE_API_KEY } from '../../credentials/GOOGLE_PLACE_API_KEY.js';

export default (PlaceSearchBox = props => {
  return (
    <GooglePlacesAutocomplete
      placeholder="Search"
      minLength={2} // minimum length of text to search
      autoFocus={false}
      listViewDisplayed={true} // true/false/undefined
      fetchDetails={true}
      // renderDescription={(row) => row.terms[0].value} // display street only
      onPress={(data, details = null) => {
        // 'details' is provided when fetchDetails = true
        props.onPress(data, details);
      }}
      getDefaultValue={text => {
        // this.props.getDefaultValue(text);
      }}
      query={{
        // available options: https://developers.google.com/places/web-service/autocomplete
        key: PLACE_API_KEY,
        language: 'en' // language of the results
        // types: '(cities)', // default: 'geocode'
      }}
      styles={{
        description: {
          fontWeight: 'bold'
        },
        predefinedPlacesDescription: {
          color: '#1faadb'
        },
        powered: {
          width: null,
          height: null
        },
        poweredContainer: {
          height: 0,
          margin: 0,
          padding: 0
        }
      }}
      // currentLocation={true} // Will add a 'Current location' button at the top of the predefined places list
      currentLocationLabel="Current location"
      nearbyPlacesAPI="GooglePlacesSearch" // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
      GoogleReverseGeocodingQuery={
        {
          // available options for GoogleReverseGeocoding API : https://developers.google.com/maps/documentation/geocoding/intro
        }
      }
      GooglePlacesSearchQuery={{
        // available options for GooglePlacesSearch API : https://developers.google.com/places/web-service/search
        rankby: 'distance',
        types: 'food'
      }}
      filterReverseGeocodingByTypes={[
        'locality',
        'administrative_area_level_3'
      ]} // filter the reverse geocoding results by types - ['locality', 'administrative_area_level_3'] if you want to display only cities
    />
  );
});

“react”: “15.4.1” “react-native”: “0.39.2” “react-native-google-places-autocomplete”: “^1.3.6”

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
guillermodoghelcommented, Aug 25, 2018

same here. Any clue?

0reactions
vcguptacommented, May 5, 2020

Getting same error here. Not working at all

Read more comments on GitHub >

github_iconTop Results From Across the Web

Element type is invalid: expected a string (for built-in ...
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Read more >
React Native Error: Element type is invalid: expected a string ...
Coding example for the question React Native Error: Element type is invalid: expected a string or a class/functionbut got: undefined. But where?
Read more >
Element type is invalid: expected a string (for built-in components) or ...
“Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method...
Read more >
Place Autocomplete | Places API - Google Developers
The Place Autocomplete service is a web service that returns place predictions in response to an HTTP request. The request specifies a textual...
Read more >
Research Artefact: A Large-Scale Study of React-Related ...
Id PostTypeId AcceptedAnswerId OwnerUserId AnswerCount CommentCount Fa... 27279488 1 29040342 674474 3 5 0 29314839 1 29437736 2802074 2 2 3 30459180 1 30459458 745952 1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found