• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

textkernel / oneui / 6767141863

06 Nov 2023 06:30AM CUT coverage: 90.553%. Remained the same
6767141863

push

github

renovate[bot]
chore(deps): update dependency @types/react to v18.2.35

1311 of 1613 branches covered (0.0%)

Branch coverage included in aggregate %.

3079 of 3235 relevant lines covered (95.18%)

67.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
/src/components/Map/MapWithGoogleLoader/MapWithGoogleLoader.tsx
1
import * as React from 'react';
5✔
2
import { GoogleMap, LoadScriptNext, LoadScriptNextProps } from '@react-google-maps/api';
5✔
3
import { LoadingSpinner } from '../../LoadingSpinner';
5✔
4
import { Map, MapProps } from '../Map';
5✔
5
/**
6
 * ## Note about props
7
 * `MapWithGoogleLoader` is a wrapper around the `Map` component, and it makes sure the Google API is loaded on the page.
8
 *
9
 * If you don't use `Map` directly.
10
 * `MapWithGoogleLoader` __will pass props__ that are not needed for loading the API __to `Map`__,
11
 * so you can provide them all together.
12
 */
13

14
export interface Props extends MapProps {
15
    /** Google API key */
16
    apiKey: string;
17
    /** Tha language code to be used for the map (e.g en). By default the users browser language will be used
18
     * For available values see: https://developers.google.com/maps/faq#languagesupport
19
     */
20
    language?: string;
21
    /** Regional setting for the map. By default Google uses US.
22
     * For details see: https://developers.google.com/maps/documentation/javascript/localization#Region
23
     */
24
    region?: string;
25
    /** other props to pass to the google loader. For details see: https://react-google-maps-api-docs.netlify.com/#loadscriptnext */
26
    additionalGoogleProps?: Omit<LoadScriptNextProps, 'googleMapsApiKey'>;
27
}
28
export const MapWithGoogleLoader = React.forwardRef<GoogleMap, Props>(
5✔
29
    ({ apiKey, language, region, additionalGoogleProps = {}, ...rest }, ref) => {
×
30
        return (
×
31
            <LoadScriptNext
32
                googleMapsApiKey={apiKey}
33
                language={language}
34
                region={region}
35
                loadingElement={<LoadingSpinner centerIn="parent" />}
36
                {...additionalGoogleProps}
37
            >
38
                <Map ref={ref} {...rest} />
39
            </LoadScriptNext>
40
        );
41
    }
42
);
43

44
MapWithGoogleLoader.displayName = 'MapWithGoogleLoader';
5✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc