react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

Type '{}' is not assignable to type 'never' While using functional component

Open aruljayaraj opened this issue 4 years ago • 2 comments

MyMapComponent showing error Type '{}' is not assignable to type 'never' and Property 'isMarkerShown' does not exist on type 'never'

import React from 'react';
import { withScriptjs, withGoogleMap, GoogleMap, Marker  } from 'react-google-maps';

const ContactUs: React.FC = () => {
    const MyMapComponent = withScriptjs(withGoogleMap((props) => (
        <GoogleMap
            defaultZoom={8}
            defaultCenter={{ lat: -34.397, lng: 150.644 }}
        >
        {props.isMarkerShown && <Marker position={{ lat: -34.397, lng: 150.644 }} />}
        </GoogleMap>
    )) );

    return (
          <IonContent className="ion-padding">
            <IonRow>
              <IonCol>
                   <MyMapComponent isMarkerShown />
              </IonCol>
           </IonRow>
        </IonContent>
}

Anyone working around in a functional way?

aruljayaraj avatar Jun 22 '20 08:06 aruljayaraj

@aruljayaraj The repo of this project is unmaintained more than a year, and we had build new version https://www.npmjs.com/package/@react-google-maps/api

We had rewrite it to TypeScript, and updating it frequently: https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api You can enjoy autocomplete.

You can see our docs: https://react-google-maps-api-docs.netlify.app

Also a lot of examples: https://react-google-maps-api-gatsby-demo.netlify.app/ https://github.com/JustFly1984/react-google-maps-api/tree/master/packages/react-google-maps-api-gatsby-example/src/examples

The bundle size is much smaller: https://bundlephobia.com/result?p=@react-google-maps/api

Our Spectrum community: https://spectrum.chat/react-google-maps
Our Slack channel: https://join.slack.com/t/react-google-maps-api/shared_invite/enQtODc5ODU1NTY5MzQ4LTBiNTYzZmY1YmVjYzJhZThkMGU0YzUwZjJkNGJmYjk4YjQyYjZhMDk2YThlZGEzNDc0M2RhNjBmMWE4ZTJiMjQ

Enjoy!

JustFly1984 avatar Jun 22 '20 08:06 JustFly1984

Spasibo, @JustFly1984 It works like a charm.

aruljayaraj avatar Jun 22 '20 09:06 aruljayaraj