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 issueAuto 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:
- Created 6 years ago
- Comments:5
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
same here. Any clue?
Getting same error here. Not working at all