Issues loading places script for SearchField
See original GitHub issueIn the container my page component I’m loading the places script including my key and language.
const key = process.env.GOOGLE_API_KEY
const language = 'NL'
const placesUrl = `https://maps.google.com/maps/api/js?key=${ key }&language=${ language }libraries=places&sensor=false`
load(placesUrl, { async: true }, (err, script) => {
if (err) { console.log('error in load-script: ', err) }
else { console.log('succes in load-script script.src: ', script.src) }
})
Then in a child container I’m using the <GoogleMap />
-tag feeding it only an options object and defaultCenter and defaultZoom. In my console I receive the following error:
You have included the Google Maps API multiple times on this page. This may cause unexpected errors. Google Maps API warning: NoApiKeys Google Maps API warning: SensorNotRequired
Also, I recieve an error for the searchField itself, copied from the searchbox example in readme:
Uncaught ReferenceError: google is not defined
Can I feed options and defaults in GoogleMap component, even after the script was already loaded? Is there a working example with the searchField included ?
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Places Search Box | Maps JavaScript API - Google Developers
This example creates a map with a search box for users to enter geographical searches. The search box returns a pick list that...
Read more >bind google places autocomplete on textbox without ...
I'm having a problem with binding my search textbox with Autocomplete without the use of instantiating a google map. What I'm trying to...
Read more >search field script - Claris Community - FileMaker Pro
I'm wanting to create a search find script for a field within a pop-up box. Is there a simple script that would allow...
Read more >Cross Site Scripting (XSS) Attack Tutorial with Examples ...
If the search field is vulnerable, when the user enters any script, then it will be executed. Consider, a user enters a very...
Read more >ACSD-45781: Store front search field not displayed on mobile ...
The MDVA-45781 patch solves the issue where the store front search field is not ... MDVA-28651: B2B - quotes slow to load ·...
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 Free
Top 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
@matmac the answer is directly above your comment, however if you just want to use places lib in other place without map
The only way is to use custom loader which you can provide via
googleMapLoader
property, it must returnPromise
resolved towindow.google.maps
which google api defines at load.Internally if nothing is provided this loader is used: https://github.com/istarkov/google-map-react/blob/master/src/utils/loaders/google_map_loader.js
So the idea is to return Promise which will be resolved only after
third-party
or your own google-map api will be loaded.