Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change the language map in run #896

Open
amirbr opened this issue Aug 20, 2018 · 2 comments
Open

How can I change the language map in run #896

amirbr opened this issue Aug 20, 2018 · 2 comments

Comments

@amirbr
Copy link

amirbr commented Aug 20, 2018

Hello,

I need to change googleMaps language on the run, to do this I need to re-fetch google maps script with the right locale.
But when the HOC withScriptjs receive a new value for googleMapURL prop, the new URL is not fetched. Actually, withScriptjs file does not implement this behavior.

Did I miss something? Maybe @tomchentw you know why?

Can I contribute to solving this?

Thanks

@urikphytech
Copy link
Contributor

You could probably implement this behavior pretty easily.
I would imagine something like:

  1. Add the componentDidUpdate method
  2. Check if googleMapUrl has changed

If so, set loadingState to LOADING_STATE_BEGIN and then run the following lines from componentDidMount:

 const scriptjs = require(`scriptjs`)
 const { googleMapURL } = this.props
 scriptjs(googleMapURL, this.handleLoaded)

(Should probably be extracted to a function)

@JustFly1984
Copy link

Is there any update? I need this feature for my app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants