Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

feat(DOMMaps): expose withGoogleMaps HOC [PART-1] #2000

Merged
merged 2 commits into from
Feb 12, 2019
Merged

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Feb 8, 2019

Summary

This PR introduces a new HOC for the maps package. It's now part of the public API because we export this component. The HOC gives access to the google object and the googleMapsInstance which is the instance of the map.

Users might want to leverage this to create their own layer on top of our geo search widget. It was already the case with the heatmap PR. Now it's possible to build it in user-land.

We choose the HOC over a render prop because it's easier to build a component with lifecycle hooks out of an HOC. With a render prop you have to create a layer to extract the value and provide it to the component that will use it. We can built an HOC out of render prop so if someone ask for it we can refactor the API to provide both.

Usage

const Heatmap = withGoogleMaps({ google, googleMapsInstance }) => null;

const App = () => (
  <GeoSearch google={google}>
    {() => (
      <Fragment>
        <Heatmap />
      </Fragment>
    )}
  </GeoSearch>
);

@samouss samouss requested a review from a team February 8, 2019 15:59
@algobot
Copy link
Contributor

algobot commented Feb 8, 2019

Deploy preview for react-instantsearch ready!

Built with commit 9b243db

https://deploy-preview-2000--react-instantsearch.netlify.com

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good

* feat(DOMMaps): use withGoogleMaps for Marker [PART-3] (#2002)

* feat(DOMMaps): use withGoogleMaps for Redo [PART-4] (#2003)

* feat(DOMMaps): use withGoogleMaps for Control [PART-5] (#2004)

* feat(DOMMaps): drop usage of GOOGLE_MAPS_CONTEXT [PART-6] (#2005)
@samouss samouss merged commit 2ae1dea into master Feb 12, 2019
@samouss samouss deleted the feat/gmaps-1-hoc branch February 12, 2019 14:15
samouss added a commit that referenced this pull request Apr 23, 2019
# [5.5.0](v5.4.0...v5.5.0) (2019-04-23)

### Bug Fixes

* **createInstantSearch:** change the User-Agent to use the new specs ([#2209](#2209)) ([642ba0b](642ba0b))

### Features

* **DOMMaps:** expose withGoogleMaps HOC [PART-1] ([#2000](#2000)) ([2ae1dea](2ae1dea))
* **queryRules:** add Query Rules features ([#2286](#2286)) ([3ae9c01](3ae9c01))
* **insights:** add insights features ([#2215](#2215)) ([961e7a7](961e7a7))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants