@maplibre/maplibre-react-native 10.0.0-alpha.8 → 10.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/docs/Camera.md +1 -1
- package/docs/MapView.md +9 -9
- package/docs/MarkerView.md +1 -1
- package/docs/NativeUserLocation.md +1 -1
- package/docs/PointAnnotation.md +2 -2
- package/docs/UserLocation.md +2 -2
- package/docs/docs.json +12 -12
- package/javascript/@types/assets.d.ts +1 -1
- package/javascript/MLNModule.ts +2 -2
- package/javascript/Maplibre.ts +37 -42
- package/javascript/components/BackgroundLayer.tsx +9 -9
- package/javascript/components/Callout.tsx +19 -19
- package/javascript/components/Camera.tsx +29 -29
- package/javascript/components/CircleLayer.tsx +9 -9
- package/javascript/components/FillExtrusionLayer.tsx +9 -9
- package/javascript/components/FillLayer.tsx +9 -9
- package/javascript/components/HeadingIndicator.tsx +7 -8
- package/javascript/components/HeatmapLayer.tsx +10 -10
- package/javascript/components/ImageSource.tsx +8 -8
- package/javascript/components/Images.tsx +19 -20
- package/javascript/components/Light.tsx +15 -15
- package/javascript/components/LineLayer.tsx +9 -9
- package/javascript/components/MapView.tsx +74 -70
- package/javascript/components/MarkerView.tsx +9 -10
- package/javascript/components/NativeUserLocation.tsx +4 -4
- package/javascript/components/PointAnnotation.tsx +17 -17
- package/javascript/components/RasterLayer.tsx +9 -9
- package/javascript/components/RasterSource.tsx +10 -10
- package/javascript/components/ShapeSource.tsx +63 -61
- package/javascript/components/Style.tsx +69 -59
- package/javascript/components/SymbolLayer.tsx +10 -10
- package/javascript/components/UserLocation.tsx +23 -23
- package/javascript/components/VectorSource.tsx +19 -19
- package/javascript/components/annotations/Annotation.tsx +16 -15
- package/javascript/hooks/useAbstractLayer.ts +15 -12
- package/javascript/hooks/useAbstractSource.ts +2 -2
- package/javascript/hooks/useNativeBridge.ts +7 -7
- package/javascript/hooks/useNativeRef.ts +2 -2
- package/javascript/hooks/useOnce.ts +1 -1
- package/javascript/index.ts +2 -2
- package/javascript/modules/location/locationManager.ts +4 -4
- package/javascript/modules/offline/OfflineCreatePackOptions.ts +5 -5
- package/javascript/modules/offline/OfflinePack.ts +3 -3
- package/javascript/modules/offline/offlineManager.ts +11 -12
- package/javascript/modules/snapshot/SnapshotOptions.ts +4 -4
- package/javascript/modules/snapshot/snapshotManager.ts +2 -2
- package/javascript/requestAndroidLocationPermissions.ts +3 -3
- package/javascript/types/OnPressEvent.ts +1 -1
- package/javascript/types/index.ts +6 -2
- package/javascript/utils/BridgeValue.ts +20 -20
- package/javascript/utils/Logger.ts +14 -14
- package/javascript/utils/MaplibreStyles.d.ts +359 -359
- package/javascript/utils/StyleValue.ts +12 -12
- package/javascript/utils/animated/AbstractAnimatedCoordinates.ts +6 -6
- package/javascript/utils/animated/Animated.ts +38 -16
- package/javascript/utils/animated/AnimatedCoordinatesArray.ts +7 -11
- package/javascript/utils/animated/AnimatedExtractCoordinateFromArray.ts +3 -3
- package/javascript/utils/animated/AnimatedPoint.ts +7 -7
- package/javascript/utils/animated/AnimatedRouteCoordinatesArray.ts +16 -20
- package/javascript/utils/animated/AnimatedShape.ts +15 -15
- package/javascript/utils/deprecation.ts +6 -3
- package/javascript/utils/filterUtils.ts +1 -1
- package/javascript/utils/geoUtils.ts +8 -8
- package/javascript/utils/index.ts +14 -14
- package/javascript/utils/styleMap.ts +18 -18
- package/package.json +28 -15
- package/plugin/build/withMapLibre.d.ts +2 -2
- package/plugin/build/withMapLibre.js +24 -24
- package/scripts/autogenerate.js +1 -1
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -169
- package/.prettierrc.js +0 -7
- package/.yarn/sdks/eslint/bin/eslint.js +0 -27
- package/.yarn/sdks/eslint/lib/api.js +0 -27
- package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -27
- package/.yarn/sdks/eslint/package.json +0 -14
- package/.yarn/sdks/integrations.yml +0 -5
- package/.yarn/sdks/prettier/bin/prettier.cjs +0 -27
- package/.yarn/sdks/prettier/index.cjs +0 -27
- package/.yarn/sdks/prettier/package.json +0 -7
- package/.yarn/sdks/typescript/bin/tsc +0 -27
- package/.yarn/sdks/typescript/bin/tsserver +0 -27
- package/.yarn/sdks/typescript/lib/tsc.js +0 -27
- package/.yarn/sdks/typescript/lib/tsserver.js +0 -239
- package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -239
- package/.yarn/sdks/typescript/lib/typescript.js +0 -27
- package/.yarn/sdks/typescript/package.json +0 -10
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { CircleLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNCircleLayer";
|
|
14
14
|
|
|
15
15
|
export interface CircleLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ export interface CircleLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<CircleLayerProps,
|
|
23
|
+
extends Omit<CircleLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNCircleLayer =
|
|
@@ -33,7 +33,7 @@ const CircleLayer: React.FC<CircleLayerProps> = ({
|
|
|
33
33
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
34
34
|
...props
|
|
35
35
|
}: CircleLayerProps) => {
|
|
36
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
36
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
37
37
|
CircleLayerProps,
|
|
38
38
|
NativeProps
|
|
39
39
|
>({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { FillExtrusionLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNFillExtrusionLayer";
|
|
14
14
|
|
|
15
15
|
export interface FillExtrusionLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ export interface FillExtrusionLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<FillExtrusionLayerProps,
|
|
23
|
+
extends Omit<FillExtrusionLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNFillExtrusionLayer =
|
|
@@ -33,7 +33,7 @@ const FillExtrusionLayer: React.FC<FillExtrusionLayerProps> = ({
|
|
|
33
33
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
34
34
|
...props
|
|
35
35
|
}: FillExtrusionLayerProps) => {
|
|
36
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
36
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
37
37
|
FillExtrusionLayerProps,
|
|
38
38
|
NativeProps
|
|
39
39
|
>({
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { FillLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNFillLayer";
|
|
14
14
|
|
|
15
15
|
export interface FillLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ export interface FillLayerProps extends BaseProps, BaseLayerProps {
|
|
|
19
19
|
style?: FillLayerStyleProps;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface NativeProps extends Omit<FillLayerProps,
|
|
22
|
+
interface NativeProps extends Omit<FillLayerProps, "style">, NativeBaseProps {}
|
|
23
23
|
|
|
24
24
|
const RCTMLNFillLayer = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
25
25
|
|
|
@@ -30,7 +30,7 @@ const FillLayer: React.FC<FillLayerProps> = ({
|
|
|
30
30
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
31
31
|
...props
|
|
32
32
|
}: FillLayerProps) => {
|
|
33
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
33
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
34
34
|
FillLayerProps,
|
|
35
35
|
NativeProps
|
|
36
36
|
>({
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import headingIcon from '../../assets/heading.png';
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
3
2
|
|
|
4
|
-
import SymbolLayer from
|
|
5
|
-
|
|
6
|
-
import
|
|
3
|
+
import SymbolLayer from "./SymbolLayer";
|
|
4
|
+
import headingIcon from "../../assets/heading.png";
|
|
5
|
+
import BaseProps from "../types/BaseProps";
|
|
7
6
|
|
|
8
7
|
const style = {
|
|
9
8
|
iconImage: headingIcon,
|
|
10
9
|
iconAllowOverlap: true,
|
|
11
|
-
iconPitchAlignment:
|
|
12
|
-
iconRotationAlignment:
|
|
10
|
+
iconPitchAlignment: "map",
|
|
11
|
+
iconRotationAlignment: "map",
|
|
13
12
|
} as const;
|
|
14
13
|
|
|
15
14
|
interface HeadingIndicatorProps extends BaseProps {
|
|
16
15
|
heading?: number;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
const HeadingIndicator = ({heading}: HeadingIndicatorProps): ReactElement => (
|
|
18
|
+
const HeadingIndicator = ({ heading }: HeadingIndicatorProps): ReactElement => (
|
|
20
19
|
<SymbolLayer
|
|
21
20
|
key="mapboxUserLocationHeadingIndicator"
|
|
22
21
|
id="mapboxUserLocationHeadingIndicator"
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { HeatmapLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNHeatmapLayer";
|
|
14
14
|
|
|
15
|
-
interface HeatmapLayerProps extends BaseProps, BaseLayerProps {
|
|
15
|
+
export interface HeatmapLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
17
17
|
* Customizable style attributes
|
|
18
18
|
*/
|
|
@@ -20,7 +20,7 @@ interface HeatmapLayerProps extends BaseProps, BaseLayerProps {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
interface NativeProps
|
|
23
|
-
extends Omit<HeatmapLayerProps,
|
|
23
|
+
extends Omit<HeatmapLayerProps, "style">,
|
|
24
24
|
NativeBaseProps {}
|
|
25
25
|
|
|
26
26
|
const RCTMLNHeatmapLayer =
|
|
@@ -32,7 +32,7 @@ const HeatmapLayer: React.FC<HeatmapLayerProps> = ({
|
|
|
32
32
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
33
33
|
...props
|
|
34
34
|
}: HeatmapLayerProps) => {
|
|
35
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
35
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
36
36
|
HeatmapLayerProps,
|
|
37
37
|
NativeProps
|
|
38
38
|
>({
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
4
|
+
import useAbstractSource from "../hooks/useAbstractSource";
|
|
5
|
+
import BaseProps from "../types/BaseProps";
|
|
1
6
|
import {
|
|
2
7
|
cloneReactChildrenWithProps,
|
|
3
8
|
isNumber,
|
|
4
9
|
resolveImagePath,
|
|
5
|
-
} from
|
|
6
|
-
import BaseProps from '../types/BaseProps';
|
|
7
|
-
import useAbstractSource from '../hooks/useAbstractSource';
|
|
8
|
-
|
|
9
|
-
import {requireNativeComponent} from 'react-native';
|
|
10
|
-
import React, {ReactElement} from 'react';
|
|
10
|
+
} from "../utils";
|
|
11
11
|
|
|
12
|
-
export const NATIVE_MODULE_NAME =
|
|
12
|
+
export const NATIVE_MODULE_NAME = "RCTMLNImageSource";
|
|
13
13
|
|
|
14
14
|
export interface ImageSourceProps extends BaseProps {
|
|
15
15
|
/**
|
|
@@ -44,7 +44,7 @@ const RCTMLNImageSource =
|
|
|
44
44
|
* The georeferenced image scales and rotates as the user zooms and rotates the map
|
|
45
45
|
*/
|
|
46
46
|
const ImageSource: React.FC<ImageSourceProps> = (props: ImageSourceProps) => {
|
|
47
|
-
const {setNativeRef} = useAbstractSource<NativeProps>();
|
|
47
|
+
const { setNativeRef } = useAbstractSource<NativeProps>();
|
|
48
48
|
|
|
49
49
|
const _getURL = (): string | undefined => {
|
|
50
50
|
return isNumber(props.url) ? resolveImagePath(props.url) : props.url;
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {SHAPE_SOURCE_NATIVE_ASSETS_KEY} from './ShapeSource';
|
|
4
|
-
|
|
5
|
-
import React, {ReactElement} from 'react';
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
6
2
|
import {
|
|
7
3
|
requireNativeComponent,
|
|
8
4
|
Image,
|
|
9
5
|
NativeSyntheticEvent,
|
|
10
6
|
ImageSourcePropType,
|
|
11
7
|
ImageURISource,
|
|
12
|
-
} from
|
|
8
|
+
} from "react-native";
|
|
9
|
+
|
|
10
|
+
import { SHAPE_SOURCE_NATIVE_ASSETS_KEY } from "./ShapeSource";
|
|
11
|
+
import BaseProps from "../types/BaseProps";
|
|
13
12
|
|
|
14
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNImages";
|
|
15
14
|
|
|
16
15
|
export type ImageEntry = string | ImageSourcePropType;
|
|
17
16
|
|
|
18
17
|
function _isUrlOrPath(value: ImageEntry): boolean {
|
|
19
18
|
return (
|
|
20
|
-
(typeof value ===
|
|
21
|
-
(value.startsWith(
|
|
22
|
-
value.startsWith(
|
|
23
|
-
value.startsWith(
|
|
24
|
-
value.startsWith(
|
|
25
|
-
value.startsWith(
|
|
26
|
-
value.startsWith(
|
|
19
|
+
(typeof value === "string" || value instanceof String) &&
|
|
20
|
+
(value.startsWith("file://") ||
|
|
21
|
+
value.startsWith("http://") ||
|
|
22
|
+
value.startsWith("https://") ||
|
|
23
|
+
value.startsWith("data:") ||
|
|
24
|
+
value.startsWith("asset://") ||
|
|
25
|
+
value.startsWith("/"))
|
|
27
26
|
);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
function _isImageSourcePropType(
|
|
31
30
|
value: ImageEntry,
|
|
32
31
|
): value is ImageSourcePropType {
|
|
33
|
-
if (typeof value ===
|
|
32
|
+
if (typeof value === "number" || value instanceof Number) {
|
|
34
33
|
return true;
|
|
35
34
|
}
|
|
36
35
|
const valueAsSource = value as ImageURISource;
|
|
37
|
-
return !!valueAsSource.uri && typeof valueAsSource.uri ===
|
|
36
|
+
return !!valueAsSource.uri && typeof valueAsSource.uri === "string";
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
interface ImagesProps extends BaseProps {
|
|
@@ -43,7 +42,7 @@ interface ImagesProps extends BaseProps {
|
|
|
43
42
|
* Keys are names - see iconImage expressions, values can be either urls-s objects
|
|
44
43
|
* with format {uri: 'http://...'}` or `require('image.png')` or `import 'image.png'`
|
|
45
44
|
*/
|
|
46
|
-
images?: {[key: string]: ImageEntry};
|
|
45
|
+
images?: { [key: string]: ImageEntry };
|
|
47
46
|
/**
|
|
48
47
|
* If you have an asset under Image.xcassets on iOS and the drawables directory on android
|
|
49
48
|
* you can specify an array of string names with assets as the key `['pin']`.
|
|
@@ -69,14 +68,14 @@ const Images = ({
|
|
|
69
68
|
children,
|
|
70
69
|
}: ImagesProps): ReactElement => {
|
|
71
70
|
const _getImages = (): {
|
|
72
|
-
images?: {[key: string]: ImageEntry};
|
|
71
|
+
images?: { [key: string]: ImageEntry };
|
|
73
72
|
nativeImages?: ImageEntry[];
|
|
74
73
|
} => {
|
|
75
74
|
if (!images && !nativeAssetImages) {
|
|
76
75
|
return {};
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
const imagesResult: {[key: string]: ImageEntry} = {};
|
|
78
|
+
const imagesResult: { [key: string]: ImageEntry } = {};
|
|
80
79
|
let nativeImages: ImageEntry[] = [];
|
|
81
80
|
|
|
82
81
|
if (images) {
|
|
@@ -113,7 +112,7 @@ const Images = ({
|
|
|
113
112
|
};
|
|
114
113
|
|
|
115
114
|
const _onImageMissing = (
|
|
116
|
-
event: NativeSyntheticEvent<{payload: {imageKey: string}}>,
|
|
115
|
+
event: NativeSyntheticEvent<{ payload: { imageKey: string } }>,
|
|
117
116
|
): void => {
|
|
118
117
|
if (onImageMissing) {
|
|
119
118
|
onImageMissing(event.nativeEvent.payload.imageKey);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {StyleValue} from '../utils/StyleValue';
|
|
4
|
-
import {BaseLayerProps} from '../hooks/useAbstractLayer';
|
|
5
|
-
import useAbstractLayer from '../hooks/useAbstractLayer';
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { requireNativeComponent } from "react-native";
|
|
6
3
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
import useAbstractLayer, { BaseLayerProps } from "../hooks/useAbstractLayer";
|
|
5
|
+
import BaseProps from "../types/BaseProps";
|
|
6
|
+
import { LightLayerStyleProps } from "../utils/MaplibreStyles";
|
|
7
|
+
import { StyleValue } from "../utils/StyleValue";
|
|
9
8
|
|
|
10
|
-
export const NATIVE_MODULE_NAME =
|
|
9
|
+
export const NATIVE_MODULE_NAME = "RCTMLNLight";
|
|
11
10
|
|
|
12
11
|
interface LightProps extends BaseProps, BaseLayerProps {
|
|
13
12
|
/**
|
|
@@ -16,8 +15,8 @@ interface LightProps extends BaseProps, BaseLayerProps {
|
|
|
16
15
|
style?: LightLayerStyleProps;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
interface NativeProps extends Omit<LightProps,
|
|
20
|
-
reactStyle?: {[key: string]: StyleValue};
|
|
18
|
+
interface NativeProps extends Omit<LightProps, "style"> {
|
|
19
|
+
reactStyle?: { [key: string]: StyleValue };
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
const RCTMLNLight = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
@@ -26,11 +25,12 @@ const RCTMLNLight = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
|
26
25
|
* Light represents the light source for extruded geometries
|
|
27
26
|
*/
|
|
28
27
|
const Light: React.FC<LightProps> = (props: LightProps) => {
|
|
29
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
29
|
+
LightProps,
|
|
30
|
+
NativeProps
|
|
31
|
+
>({
|
|
32
|
+
...props,
|
|
33
|
+
});
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<RCTMLNLight ref={setNativeLayer} testID="rctmlnLight" {...baseProps} />
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
|
+
|
|
3
4
|
import useAbstractLayer, {
|
|
4
5
|
BaseLayerProps,
|
|
5
6
|
NativeBaseProps,
|
|
6
|
-
} from
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {NativeModules, requireNativeComponent} from 'react-native';
|
|
7
|
+
} from "../hooks/useAbstractLayer";
|
|
8
|
+
import BaseProps from "../types/BaseProps";
|
|
9
|
+
import { LineLayerStyleProps } from "../utils/MaplibreStyles";
|
|
10
10
|
|
|
11
11
|
const MapLibreGL = NativeModules.MLNModule;
|
|
12
12
|
|
|
13
|
-
export const NATIVE_MODULE_NAME =
|
|
13
|
+
export const NATIVE_MODULE_NAME = "RCTMLNLineLayer";
|
|
14
14
|
|
|
15
15
|
export interface LineLayerProps extends BaseProps, BaseLayerProps {
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ export interface LineLayerProps extends BaseProps, BaseLayerProps {
|
|
|
19
19
|
style?: LineLayerStyleProps;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface NativeProps extends Omit<LineLayerProps,
|
|
22
|
+
interface NativeProps extends Omit<LineLayerProps, "style">, NativeBaseProps {}
|
|
23
23
|
|
|
24
24
|
const RCTMLNLineLayer =
|
|
25
25
|
requireNativeComponent<NativeBaseProps>(NATIVE_MODULE_NAME);
|
|
@@ -31,7 +31,7 @@ const LineLayer: React.FC<LineLayerProps> = ({
|
|
|
31
31
|
sourceID = MapLibreGL.StyleSource.DefaultSourceID,
|
|
32
32
|
...props
|
|
33
33
|
}: LineLayerProps) => {
|
|
34
|
-
const {baseProps, setNativeLayer} = useAbstractLayer<
|
|
34
|
+
const { baseProps, setNativeLayer } = useAbstractLayer<
|
|
35
35
|
LineLayerProps,
|
|
36
36
|
NativeProps
|
|
37
37
|
>({
|