SamSamskies / react-map-gl-geocoder

React wrapper for mapbox-gl-geocoder for use with react-map-gl
MIT License
122 stars 29 forks source link

When using containerRef input options do not collapse #84

Closed nerijusgood closed 3 years ago

nerijusgood commented 4 years ago

If necessary i can try re-create issue.

SamSamskies commented 4 years ago

Hi @nerijusgood, make sure that your non-primitive prop values are memoized. Please provide a Code Sandbox if you need help figuring out how to do this. Here's an example https://codesandbox.io/s/react-map-gl-geocoder-using-containerref-to-ignore-events-rewdh.

fletcherdemeo commented 3 years ago

Hi @SamSamskies, I'm having a similar issue when rendering multiple geocoders:

I have attempted to memoize my non-primitive prop values and this has not changed the result, however this is the first time that I have memoized in React so not sure if done correctly.

I have recreated these issues in Code Sandbox - https://codesandbox.io/s/multiple-react-gl-geocoders-clkps?file=/src/App.js (I've removed my mapbox token in App).

Thanks for this great project!

SamSamskies commented 3 years ago

Hi @fletcherdemeo, your onResult prop is not memoized.

fletcherdemeo commented 3 years ago

Thanks @SamSamskies, much appreciated? Any idea why the first child that renders initially does not leave a marker?

SamSamskies commented 3 years ago

@fletcherdemeo my guess would be that it has something to do with onResult not being memoized.