Comments (7)
How to you use it? Can you show me some implementation code?
from react-geosuggest.
Here it is. Developer who used to work on the app used googleMaps props in GeoSuggest(don't know why). As I was told, that worked for over a year at least. Maybe it's worth mentioning that application is wrapped in react-on-rails. Also, after updating the component nothing changed
renderSearchBar(googleMaps) {
const {
isAuthenticated,
user,
intl: { formatMessage },
locale,
} = this.props;
let fixtures = [];
if (isAuthenticated) {
const {
street,
number,
zip,
city,
coordinates: { lat, lon },
} = user.address;
const label = `${street} ${number}, ${zip} ${city}`;
const location = { lat, lng: lon };
fixtures = [{ label, location, className: 'favorite' }];
}
const invalidNumberCss = this.state.isInvalidNumber ? 'invalid' : '';
const geosuggestLabel = document.getElementsByClassName('geosuggest-label')[0];
const localizeString = () => {
if (geosuggestLabel !== undefined){
if (locale === 'it') {
geosuggestLabel.innerText =
'Indirizzi recenti';
} else {
geosuggestLabel.innerText =
'Recent addresses';
}
}
};
return (
<div className="address-search">
<Geosuggest
googleMaps={googleMaps}
country="it"
types={['address']}
placeholder={formatMessage({
id: 'client.home.delivery.address_search_placeholder',
})}
initialValue=""
autoFocus={this.state.focusIndex === 0}
fixtures={fixtures}
onSuggestSelect={this.onSuggestSelect}
placeDetailFields={['address_components', 'geometry']}
skipSuggest={this.skipSuggest}
onClick={localizeString}
ref={(el) => (this._geoSuggest = el)}
/>
...
render() {
const { currentStep, locale } = this.props;
if (currentStep === 4) {
return null;
}
return (
<div className="address col-lg-height col-top">
<ReactGoogleMapLoader
params={{
key: GOOGLE_MAPS_API_KEY, // Define your api key here
libraries: 'places,geometry', // To request multiple libraries, separate them with a comma
language: locale,
}}
render={(googleMaps, error) => {
if (googleMaps) {
if (error) {
// Show a custom error if SDK Authentication Error. See N/B 2 below.
return <div>{error}</div>;
}
return this.renderSearchBar(googleMaps);
}
// Check for network error so loading state ends if user lost connection.
if (error === 'Network Error') {
return <div>{error}</div>;
}
return <div>Google address search is loading...</div>;
}}
/>
</div>
);
}```
from react-geosuggest.
Ok. Can't see anything suspicious. Unless you have changed something in the module itself I can't see where this error comes from.
You can pass your own google maps instance to geosuggest. Like in this case you create the instance with ReactGoogleMapLoader
.
from react-geosuggest.
How is the geosuggest imported and installed?
from react-geosuggest.
It's installed using yarn and it's imported like this: import Geosuggest from 'react-geosuggest';
from react-geosuggest.
Having this same issue. I'm just trying to integrate this library for the first time and I'm getting this error.
Not sure if it has to do that my project uses react 15.6, which is kind of old nowadays.
from react-geosuggest.
Ok, I tried with 2.13.0 and the issue disappeared.
To me, the problem might be related with this PR for 2.13.1, but sadly I don't have the time to check deeply, so I'll work with 2.13.0 in the meantime.
from react-geosuggest.
Related Issues (20)
- Billing issues HOT 3
- Expose TypeScript type definitions
- Warning: Prop `aria-owns` did not match. HOT 1
- selectSuggest doesn't trigger onSelectSuggests HOT 3
- Inconsitent suggest.gmaps property received in onSuggestSelect HOT 2
- Test `react-geosuggest` with puppeteer HOT 1
- utc_offset is deprecated as of November 2019 and will beturned off in November 2020. Use utc_offset_minutes instead. HOT 3
- How to allow current location ? and get address based on current location coordinates ? HOT 1
- ul role=listbox should define an aria-label or aria-labelledby HOT 2
- Support React 17 HOT 2
- Selected suggestion didn't apply properly, when searching in Argentina region HOT 1
- Google maps API was not found in the page. HOT 2
- Handle the errors returned by the geocoder API
- Label "for" and input "id" do not match
- 'Avnei Hefetz' is an israli settlement city which is not coming in country 'IL' suggestions whereas 'Einav' is also an israli settlement city which is coming in country 'IL' suggestions. HOT 1
- How to detach geocomplete event?
- Using bounds not filtering suggests HOT 1
- Bounds, location, and radius are deprecated
- Support and document loading Maps API via Bootstrap Loader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-geosuggest.