From c3c89fad0f4ae5f5a6215c780f45094654d72d8e Mon Sep 17 00:00:00 2001 From: thanhdang198 Date: Mon, 19 Feb 2024 10:36:25 +0700 Subject: [PATCH] refactor example class name --- .npmignore | 2 +- __tests__/interface.test.js | 6 +- .../modules/location/locationManager.test.js | 12 +-- .../modules/offline/offlineManager.test.js | 88 +++++++++---------- .../modules/snapshot/snapshotManager.test.js | 4 +- example/package.json | 2 +- example/src/App.js | 6 +- .../src/examples/Animations/DriveTheLine.js | 36 ++++---- .../examples/Annotations/CustomCallout.tsx | 18 ++-- example/src/examples/Annotations/Heatmap.js | 14 +-- .../src/examples/Annotations/MarkerView.js | 16 ++-- .../Annotations/PointAnnotationAnchors.js | 16 ++-- .../Annotations/ShowPointAnnotation.js | 20 ++--- example/src/examples/CacheManagement.js | 10 +-- example/src/examples/Camera/Fit.js | 10 +-- example/src/examples/Camera/FlyTo.js | 10 +-- example/src/examples/Camera/GetCenter.js | 8 +- example/src/examples/Camera/GetZoom.js | 8 +- .../src/examples/Camera/RestrictMapBounds.js | 16 ++-- example/src/examples/Camera/SetHeading.js | 14 +-- example/src/examples/Camera/SetPitch.js | 14 +-- .../examples/Camera/SetUserTrackingModes.js | 20 ++--- example/src/examples/Camera/TakeSnapshot.js | 6 +- .../examples/Camera/TakeSnapshotWithMap.js | 8 +- example/src/examples/Camera/YoYo.js | 10 +-- .../ChoroplethLayerByZoomLevel.js | 18 ++-- .../FillRasterLayer/CustomVectorSource.js | 14 +-- .../examples/FillRasterLayer/GeoJSONSource.js | 22 ++--- .../examples/FillRasterLayer/ImageOverlay.js | 16 ++-- .../FillRasterLayer/IndoorBuilding.js | 16 ++-- .../examples/FillRasterLayer/QueryAtPoint.js | 22 ++--- .../examples/FillRasterLayer/QueryWithRect.js | 22 ++--- .../FillRasterLayer/WatercolorRasterTiles.js | 14 +-- .../src/examples/LineLayer/GradientLine.js | 14 +-- example/src/examples/Map/ChangeLayerColor.js | 10 +-- .../src/examples/Map/CreateOfflineRegion.js | 20 ++--- example/src/examples/Map/PointInMapView.js | 8 +- example/src/examples/Map/ShowAndHideLayer.js | 10 +-- example/src/examples/Map/ShowClick.js | 8 +- example/src/examples/Map/ShowMap.tsx | 20 ++--- .../src/examples/Map/ShowMapLocalStyle.tsx | 14 +-- .../src/examples/Map/ShowRegionDidChange.js | 10 +-- .../src/examples/Map/SourceLayerVisibility.js | 8 +- example/src/examples/Map/StyleJson.js | 12 +-- example/src/examples/Map/TwoByTwo.js | 16 ++-- .../examples/SymbolCircleLayer/CustomIcon.js | 14 +-- .../DataDrivenCircleColors.js | 16 ++-- .../examples/SymbolCircleLayer/EarthQuakes.js | 20 ++--- .../SymbolCircleLayer/ShapeSourceIcon.js | 16 ++-- .../examples/UserLocation/SetDisplacement.js | 14 +-- .../src/examples/UserLocation/SetTintColor.js | 10 +-- .../UserLocation/SetUserLocationRenderMode.js | 10 +-- .../SetUserLocationVerticalAlignment.js | 10 +-- .../UserLocation/UserLocationChange.js | 10 +-- .../src/examples/common/PulseCircleLayer.js | 12 +-- example/yarn.lock | 4 +- javascript/{Maplibre.ts => Vietmap.ts} | 2 +- javascript/components/AbstractLayer.tsx | 2 +- javascript/components/BackgroundLayer.tsx | 6 +- javascript/components/Camera.tsx | 12 +-- javascript/components/CircleLayer.tsx | 6 +- javascript/components/FillExtrusionLayer.tsx | 6 +- javascript/components/FillLayer.tsx | 6 +- javascript/components/HeatmapLayer.tsx | 6 +- javascript/components/Light.tsx | 2 +- javascript/components/LineLayer.tsx | 6 +- javascript/components/MapView.tsx | 66 +++++++------- javascript/components/RasterLayer.tsx | 6 +- javascript/components/RasterSource.tsx | 4 +- javascript/components/ShapeSource.tsx | 6 +- javascript/components/Style.tsx | 4 +- javascript/components/SymbolLayer.tsx | 6 +- javascript/components/UserLocation.tsx | 2 +- javascript/components/VectorSource.tsx | 6 +- .../components/annotations/Annotation.tsx | 2 +- javascript/index.ts | 6 +- .../modules/location/locationManager.ts | 4 +- javascript/modules/offline/offlineManager.ts | 36 ++++---- .../modules/snapshot/SnapshotOptions.ts | 4 +- .../modules/snapshot/snapshotManager.ts | 12 +-- javascript/utils/StyleValue.ts | 2 +- ...MaplibreStyles.d.ts => VietmapStyles.d.ts} | 0 javascript/utils/filterUtils.ts | 2 +- ...thMapLibre-test.ts => withVietmap-test.ts} | 2 +- .../src/{withMapLibre.ts => withVietmap.ts} | 0 scripts/autogenerate.js | 2 +- 86 files changed, 515 insertions(+), 515 deletions(-) rename javascript/{Maplibre.ts => Vietmap.ts} (98%) rename javascript/utils/{MaplibreStyles.d.ts => VietmapStyles.d.ts} (100%) rename plugin/src/__tests__/{withMapLibre-test.ts => withVietmap-test.ts} (96%) rename plugin/src/{withMapLibre.ts => withVietmap.ts} (100%) diff --git a/.npmignore b/.npmignore index 997ea7df..cedd6bed 100644 --- a/.npmignore +++ b/.npmignore @@ -38,7 +38,7 @@ android/gradlew android/gradlew.bat android/local.properties -# maplibre-react-native +# vietmap-react-native example __tests__ coverage diff --git a/__tests__/interface.test.js b/__tests__/interface.test.js index 24daa9e7..5347b209 100644 --- a/__tests__/interface.test.js +++ b/__tests__/interface.test.js @@ -1,9 +1,9 @@ -import MapLibreGL from '../javascript'; +import VietmapGL from '../javascript'; -// Assert that all required Maplibre modules are accessible and exported +// Assert that all required Vietmap modules are accessible and exported describe('Public Interface', () => { it('should contain all expected components and utils', () => { - const actualKeys = Object.keys(MapLibreGL); + const actualKeys = Object.keys(VietmapGL); const expectedKeys = [ // components 'MapView', diff --git a/__tests__/modules/location/locationManager.test.js b/__tests__/modules/location/locationManager.test.js index 380a1359..9b70119f 100644 --- a/__tests__/modules/location/locationManager.test.js +++ b/__tests__/modules/location/locationManager.test.js @@ -4,7 +4,7 @@ import LocationManager, { import {NativeModules} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; const MapLibreGLLocationManager = NativeModules.MGLLocationModule; const location = { @@ -69,7 +69,7 @@ describe('LocationManager', () => { describe('#addListener', () => { const myListener = jest.fn(); - MapLibreGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; + VietmapGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; afterEach(() => { locationManager._listeners = []; @@ -156,7 +156,7 @@ describe('LocationManager', () => { }); test('starts native location manager and adds event emitter listener', () => { - MapLibreGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; + VietmapGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; expect(locationManager._isListening).toStrictEqual(false); @@ -164,7 +164,7 @@ describe('LocationManager', () => { expect(MapLibreGLLocationManager.start).toHaveBeenCalledTimes(1); expect(LocationModuleEventEmitter.addListener).toHaveBeenCalledWith( - MapLibreGL.LocationCallbackName.Update, + VietmapGL.LocationCallbackName.Update, locationManager.onUpdate, ); @@ -198,7 +198,7 @@ describe('LocationManager', () => { // native location manager has no #stop exposed in tests? MapLibreGLLocationManager.stop = jest.fn(); - MapLibreGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; + VietmapGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; expect(locationManager._isListening).toStrictEqual(true); @@ -216,7 +216,7 @@ describe('LocationManager', () => { // native location manager has no #stop exposed in tests? MapLibreGLLocationManager.stop = jest.fn(); - MapLibreGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; + VietmapGL.LocationCallbackName = {Update: 'MapboxUserLocationUpdate'}; expect(locationManager._isListening).toStrictEqual(false); diff --git a/__tests__/modules/offline/offlineManager.test.js b/__tests__/modules/offline/offlineManager.test.js index 5942e53f..a5f1bf60 100644 --- a/__tests__/modules/offline/offlineManager.test.js +++ b/__tests__/modules/offline/offlineManager.test.js @@ -1,4 +1,4 @@ -import MapLibreGL from '../../../javascript'; +import VietmapGL from '../../../javascript'; import {OfflineModuleEventEmitter} from '../../../javascript/modules/offline/offlineManager'; import {NativeModules, Platform} from 'react-native'; @@ -19,7 +19,7 @@ describe('offlineManager', () => { type: 'offlinestatus', payload: { name: packOptions.name, - state: MapLibreGL.OfflinePackDownloadState.Active, + state: VietmapGL.OfflinePackDownloadState.Active, progress: 50.0, }, }; @@ -28,7 +28,7 @@ describe('offlineManager', () => { type: 'offlinestatus', payload: { name: packOptions.name, - state: MapLibreGL.OfflinePackDownloadState.Complete, + state: VietmapGL.OfflinePackDownloadState.Complete, progress: 100.0, }, }; @@ -42,37 +42,37 @@ describe('offlineManager', () => { }; afterEach(async () => { - const packs = await MapLibreGL.offlineManager.getPacks(); + const packs = await VietmapGL.offlineManager.getPacks(); for (const pack of packs) { - await MapLibreGL.offlineManager.deletePack(pack.name); + await VietmapGL.offlineManager.deletePack(pack.name); } jest.clearAllMocks(); }); it('should create pack', async () => { - let offlinePack = await MapLibreGL.offlineManager.getPack(packOptions.name); + let offlinePack = await VietmapGL.offlineManager.getPack(packOptions.name); expect(offlinePack).toBeFalsy(); - await MapLibreGL.offlineManager.createPack(packOptions); - offlinePack = await MapLibreGL.offlineManager.getPack(packOptions.name); + await VietmapGL.offlineManager.createPack(packOptions); + offlinePack = await VietmapGL.offlineManager.getPack(packOptions.name); expect(offlinePack).toBeTruthy(); }); it('should delete pack', async () => { - await MapLibreGL.offlineManager.createPack(packOptions); - let offlinePack = await MapLibreGL.offlineManager.getPack(packOptions.name); + await VietmapGL.offlineManager.createPack(packOptions); + let offlinePack = await VietmapGL.offlineManager.getPack(packOptions.name); expect(offlinePack).toBeTruthy(); - await MapLibreGL.offlineManager.deletePack(packOptions.name); - offlinePack = await MapLibreGL.offlineManager.getPack(packOptions.name); + await VietmapGL.offlineManager.deletePack(packOptions.name); + offlinePack = await VietmapGL.offlineManager.getPack(packOptions.name); expect(offlinePack).toBeFalsy(); }); it('should set max tile count limit', () => { const expectedLimit = 2000; const spy = jest.spyOn(NativeModules.MGLOfflineModule, 'setTileCountLimit'); - MapLibreGL.offlineManager.setTileCountLimit(expectedLimit); + VietmapGL.offlineManager.setTileCountLimit(expectedLimit); expect(spy).toHaveBeenCalledWith(expectedLimit); spy.mockRestore(); }); @@ -83,7 +83,7 @@ describe('offlineManager', () => { NativeModules.MGLOfflineModule, 'setProgressEventThrottle', ); - MapLibreGL.offlineManager.setProgressEventThrottle(expectedThrottleValue); + VietmapGL.offlineManager.setProgressEventThrottle(expectedThrottleValue); expect(spy).toHaveBeenCalledWith(expectedThrottleValue); spy.mockRestore(); }); @@ -92,18 +92,18 @@ describe('offlineManager', () => { it('should subscribe to native events', async () => { const spy = jest.spyOn(OfflineModuleEventEmitter, 'addListener'); const noop = () => {}; - await MapLibreGL.offlineManager.createPack(packOptions, noop, noop); + await VietmapGL.offlineManager.createPack(packOptions, noop, noop); expect(spy).toHaveBeenCalledTimes(2); spy.mockClear(); }); it('should call progress listener', async () => { const listener = jest.fn(); - await MapLibreGL.offlineManager.createPack(packOptions, listener); - const expectedOfflinePack = await MapLibreGL.offlineManager.getPack( + await VietmapGL.offlineManager.createPack(packOptions, listener); + const expectedOfflinePack = await VietmapGL.offlineManager.getPack( packOptions.name, ); - MapLibreGL.offlineManager._onProgress(mockOnProgressEvent); + VietmapGL.offlineManager._onProgress(mockOnProgressEvent); expect(listener).toHaveBeenCalledWith( expectedOfflinePack, mockOnProgressEvent.payload, @@ -112,11 +112,11 @@ describe('offlineManager', () => { it('should call error listener', async () => { const listener = jest.fn(); - await MapLibreGL.offlineManager.createPack(packOptions, null, listener); - const expectedOfflinePack = await MapLibreGL.offlineManager.getPack( + await VietmapGL.offlineManager.createPack(packOptions, null, listener); + const expectedOfflinePack = await VietmapGL.offlineManager.getPack( packOptions.name, ); - MapLibreGL.offlineManager._onError(mockErrorEvent); + VietmapGL.offlineManager._onError(mockErrorEvent); expect(listener).toHaveBeenCalledWith( expectedOfflinePack, mockErrorEvent.payload, @@ -125,66 +125,66 @@ describe('offlineManager', () => { it('should not call listeners after unsubscribe', async () => { const listener = jest.fn(); - await MapLibreGL.offlineManager.createPack( + await VietmapGL.offlineManager.createPack( packOptions, listener, listener, ); - MapLibreGL.offlineManager.unsubscribe(packOptions.name); - MapLibreGL.offlineManager._onProgress(mockOnProgressEvent); - MapLibreGL.offlineManager._onError(mockErrorEvent); + VietmapGL.offlineManager.unsubscribe(packOptions.name); + VietmapGL.offlineManager._onProgress(mockOnProgressEvent); + VietmapGL.offlineManager._onError(mockErrorEvent); expect(listener).not.toHaveBeenCalled(); }); it('should unsubscribe from native events', async () => { const noop = () => {}; - await MapLibreGL.offlineManager.createPack(packOptions, noop, noop); - MapLibreGL.offlineManager.unsubscribe(packOptions.name); + await VietmapGL.offlineManager.createPack(packOptions, noop, noop); + VietmapGL.offlineManager.unsubscribe(packOptions.name); expect( - MapLibreGL.offlineManager.subscriptionProgress.remove, + VietmapGL.offlineManager.subscriptionProgress.remove, ).toHaveBeenCalledTimes(1); expect( - MapLibreGL.offlineManager.subscriptionError.remove, + VietmapGL.offlineManager.subscriptionError.remove, ).toHaveBeenCalledTimes(1); }); it('should unsubscribe event listeners once a pack download has completed', async () => { const listener = jest.fn(); - await MapLibreGL.offlineManager.createPack( + await VietmapGL.offlineManager.createPack( packOptions, listener, listener, ); expect( - MapLibreGL.offlineManager._hasListeners( + VietmapGL.offlineManager._hasListeners( packOptions.name, - MapLibreGL.offlineManager._progressListeners, + VietmapGL.offlineManager._progressListeners, ), ).toBeTruthy(); expect( - MapLibreGL.offlineManager._hasListeners( + VietmapGL.offlineManager._hasListeners( packOptions.name, - MapLibreGL.offlineManager._errorListeners, + VietmapGL.offlineManager._errorListeners, ), ).toBeTruthy(); - MapLibreGL.offlineManager._onProgress(mockOnProgressCompleteEvent); + VietmapGL.offlineManager._onProgress(mockOnProgressCompleteEvent); expect( - MapLibreGL.offlineManager._hasListeners( + VietmapGL.offlineManager._hasListeners( packOptions.name, - MapLibreGL.offlineManager._progressListeners, + VietmapGL.offlineManager._progressListeners, ), ).toBeFalsy(); expect( - MapLibreGL.offlineManager._hasListeners( + VietmapGL.offlineManager._hasListeners( packOptions.name, - MapLibreGL.offlineManager._errorListeners, + VietmapGL.offlineManager._errorListeners, ), ).toBeFalsy(); }); @@ -199,8 +199,8 @@ describe('offlineManager', () => { const name = `test-${Date.now()}`; const noop = () => {}; const options = {...packOptions, name}; - await MapLibreGL.offlineManager.createPack(options); - await MapLibreGL.offlineManager.subscribe(name, noop, noop); + await VietmapGL.offlineManager.createPack(options); + await VietmapGL.offlineManager.subscribe(name, noop, noop); expect(spy).toHaveBeenCalled(); spy.mockRestore(); @@ -212,7 +212,7 @@ describe('offlineManager', () => { const name = `test-${Date.now()}`; const noop = () => {}; const options = {...packOptions, name}; - await MapLibreGL.offlineManager.createPack(options, noop, noop); + await VietmapGL.offlineManager.createPack(options, noop, noop); expect(spy).not.toHaveBeenCalled(); spy.mockRestore(); @@ -228,8 +228,8 @@ describe('offlineManager', () => { const name = `test-${Date.now()}`; const noop = () => {}; const options = {...packOptions, name}; - await MapLibreGL.offlineManager.createPack(options); - await MapLibreGL.offlineManager.subscribe(name, noop, noop); + await VietmapGL.offlineManager.createPack(options); + await VietmapGL.offlineManager.subscribe(name, noop, noop); expect(spy).not.toHaveBeenCalled(); spy.mockRestore(); diff --git a/__tests__/modules/snapshot/snapshotManager.test.js b/__tests__/modules/snapshot/snapshotManager.test.js index d0bb7333..466bb50b 100644 --- a/__tests__/modules/snapshot/snapshotManager.test.js +++ b/__tests__/modules/snapshot/snapshotManager.test.js @@ -1,9 +1,9 @@ -import MapLibreGL from '../../../javascript'; +import VietmapGL from '../../../javascript'; describe('snapshotManager', () => { it('should resolve uri', async () => { const options = {centerCoordinate: [1, 2]}; - const uri = await MapLibreGL.snapshotManager.takeSnap(options); + const uri = await VietmapGL.snapshotManager.takeSnap(options); expect(uri).toEqual('file://test.png'); }); }); diff --git a/example/package.json b/example/package.json index ef7f21bc..e30f00bf 100644 --- a/example/package.json +++ b/example/package.json @@ -1,5 +1,5 @@ { - "name": "RNMaplibreExample", + "name": "RNVietmapExample", "version": "1.0.0", "private": true, "scripts": { diff --git a/example/src/App.js b/example/src/App.js index 007b2127..77a9e956 100755 --- a/example/src/App.js +++ b/example/src/App.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {StyleSheet, Text, View, LogBox, SafeAreaView} from 'react-native'; import Icon from 'react-native-vector-icons/MaterialIcons'; @@ -20,7 +20,7 @@ const styles = StyleSheet.create({ }, }); -MapLibreGL.setAccessToken(null); +VietmapGL.setAccessToken(null); Icon.loadFont(); class App extends React.Component { @@ -36,7 +36,7 @@ class App extends React.Component { async componentDidMount() { if (IS_ANDROID) { - const isGranted = await MapLibreGL.requestAndroidLocationPermissions(); + const isGranted = await VietmapGL.requestAndroidLocationPermissions(); this.setState({ isAndroidPermissionGranted: isGranted, isFetchingAndroidPermission: false, diff --git a/example/src/examples/Animations/DriveTheLine.js b/example/src/examples/Animations/DriveTheLine.js index f8486cb4..a6982884 100755 --- a/example/src/examples/Animations/DriveTheLine.js +++ b/example/src/examples/Animations/DriveTheLine.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {View, StyleSheet} from 'react-native'; import {Button} from 'react-native-elements'; import {lineString as makeLineString} from '@turf/helpers'; @@ -40,7 +40,7 @@ const layerStyles = { }, route: { lineColor: 'white', - lineCap: MapLibreGL.LineJoin.Round, + lineCap: VietmapGL.LineJoin.Round, lineWidth: 3, lineOpacity: 0.84, }, @@ -102,13 +102,13 @@ class DriveTheLine extends React.Component { } return ( - - + - + ); } @@ -141,13 +141,13 @@ class DriveTheLine extends React.Component { const lineString = makeLineString(coords); return ( - - + - + ); } @@ -161,9 +161,9 @@ class DriveTheLine extends React.Component { const style = [layerStyles.origin, {circleColor: backgroundColor}]; return ( - - - + + + ); } @@ -187,11 +187,11 @@ class DriveTheLine extends React.Component { render() { return ( - (this._map = c)} style={sheet.matchParent} - styleURL={MapLibreGL.StyleURL.Default}> - + @@ -202,15 +202,15 @@ class DriveTheLine extends React.Component { {this.renderCurrentPoint()} {this.renderProgressLine()} - - - - + + {this.renderActions()} diff --git a/example/src/examples/Annotations/CustomCallout.tsx b/example/src/examples/Annotations/CustomCallout.tsx index 03a5250f..b5fb0b6f 100644 --- a/example/src/examples/Annotations/CustomCallout.tsx +++ b/example/src/examples/Annotations/CustomCallout.tsx @@ -1,5 +1,5 @@ import React, {FC, useState} from 'react'; -import MapLibreGL, {SymbolLayerStyle} from '@maplibre/maplibre-react-native'; +import VietmapGL, {SymbolLayerStyle} from '@maplibre/maplibre-react-native'; import {Feature} from '@turf/helpers/dist/js'; import {View, Text, ViewStyle, StyleProp, TextStyle} from 'react-native'; import {ReactElement} from 'react'; @@ -63,25 +63,25 @@ const CustomCallout = (props: CustomCalloutProps): ReactElement => { return ( - - - + + - - + {selectedFeature && ( - - + )} - + ); }; diff --git a/example/src/examples/Annotations/Heatmap.js b/example/src/examples/Annotations/Heatmap.js index c83b27d8..e842cb08 100644 --- a/example/src/examples/Annotations/Heatmap.js +++ b/example/src/examples/Annotations/Heatmap.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import {SF_OFFICE_COORDINATE} from '../../utils'; @@ -8,16 +8,16 @@ import Page from '../common/Page'; function Heatmap() { return ( - - + - - - - + + ); } diff --git a/example/src/examples/Annotations/MarkerView.js b/example/src/examples/Annotations/MarkerView.js index a15eec90..1825affb 100644 --- a/example/src/examples/Annotations/MarkerView.js +++ b/example/src/examples/Annotations/MarkerView.js @@ -1,6 +1,6 @@ import React from 'react'; import {View, Text, TouchableOpacity} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import PropTypes from 'prop-types'; import sheet from '../../styles/sheet'; @@ -51,26 +51,26 @@ class ShowMarkerView extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} onDidFinishLoadingMap={this.onDidFinishLoadingMap} style={sheet.matchParent}> - - - + - + - - + + Click to add a point annotation diff --git a/example/src/examples/Annotations/PointAnnotationAnchors.js b/example/src/examples/Annotations/PointAnnotationAnchors.js index 119614a4..1c58a135 100644 --- a/example/src/examples/Annotations/PointAnnotationAnchors.js +++ b/example/src/examples/Annotations/PointAnnotationAnchors.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {StyleSheet, Text, View} from 'react-native'; import sheet from '../../styles/sheet'; @@ -73,10 +73,10 @@ const styles = StyleSheet.create({ const PointAnnotationAnchors = props => { return ( - - + + {corners.map((p, i) => ( - { x={p.anchor.x.toPrecision(2)}, y={p.anchor.y.toPrecision(2)} - + ))} {sides.map((p, i) => { let {x, y} = p.anchor; @@ -97,7 +97,7 @@ const PointAnnotationAnchors = props => { y = 0; } return ( - { x={p.anchor.x.toPrecision(2)}, y={p.anchor.y.toPrecision(2)} - + ); })} - + ); }; diff --git a/example/src/examples/Annotations/ShowPointAnnotation.js b/example/src/examples/Annotations/ShowPointAnnotation.js index fca3ab88..5c30cce2 100755 --- a/example/src/examples/Annotations/ShowPointAnnotation.js +++ b/example/src/examples/Annotations/ShowPointAnnotation.js @@ -1,6 +1,6 @@ import React from 'react'; import {Animated, View, Text, StyleSheet, Image} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import PropTypes from 'prop-types'; import sheet from '../../styles/sheet'; @@ -29,7 +29,7 @@ class AnnotationWithRemoteImage extends React.Component { render() { const {id, coordinate, title} = this.props; return ( - this.annotationRef.refresh()} /> - - + + ); } } @@ -140,14 +140,14 @@ class ShowPointAnnotation extends React.Component { ); } else { items.push( - - - , + + , ); } } @@ -158,18 +158,18 @@ class ShowPointAnnotation extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} onDidFinishLoadingMap={this.onDidFinishLoadingMap} style={sheet.matchParent}> - {this.renderAnnotations()} - + Click to add a point annotation diff --git a/example/src/examples/CacheManagement.js b/example/src/examples/CacheManagement.js index a01c8b43..f9b27742 100755 --- a/example/src/examples/CacheManagement.js +++ b/example/src/examples/CacheManagement.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL, {MapView, Camera} from '@maplibre/maplibre-react-native'; +import VietmapGL, {MapView, Camera} from '@maplibre/maplibre-react-native'; import { Alert, StyleSheet, @@ -53,23 +53,23 @@ class CacheManagement extends React.Component { }; invalidateAmbientCache = async () => { - await MapLibreGL.offlineManager.invalidateAmbientCache(); + await VietmapGL.offlineManager.invalidateAmbientCache(); Alert.alert('Ambient cache successfully invalidated'); }; resetDatabase = async () => { - await MapLibreGL.offlineManager.resetDatabase(); + await VietmapGL.offlineManager.resetDatabase(); Alert.alert('Database successfully reset'); }; clearAmbientCache = async () => { - await MapLibreGL.offlineManager.clearAmbientCache(); + await VietmapGL.offlineManager.clearAmbientCache(); Alert.alert('Ambient cache successfully cleared'); }; setMaximumAmbientCacheSize = async () => { const newMaxSize = parseInt(this.state.cacheSize, 10); - await MapLibreGL.offlineManager.setMaximumAmbientCacheSize(newMaxSize); + await VietmapGL.offlineManager.setMaximumAmbientCacheSize(newMaxSize); Alert.alert(`Max cache size successfully set to ${newMaxSize} bytes`); }; diff --git a/example/src/examples/Camera/Fit.js b/example/src/examples/Camera/Fit.js index 70fa84a8..1094ad3f 100755 --- a/example/src/examples/Camera/Fit.js +++ b/example/src/examples/Camera/Fit.js @@ -2,7 +2,7 @@ import React from 'react'; import {View, Text} from 'react-native'; import {isEqual} from 'lodash'; import {ScrollView, TouchableOpacity} from 'react-native-gesture-handler'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import Page from '../common/Page'; @@ -205,17 +205,17 @@ class Fit extends React.Component { return ( - - (this.camera = ref)} {...this.cameraProps()} /> - + - - + - - + + ); } diff --git a/example/src/examples/Camera/GetCenter.js b/example/src/examples/Camera/GetCenter.js index b74bf29c..e812c19f 100755 --- a/example/src/examples/Camera/GetCenter.js +++ b/example/src/examples/Camera/GetCenter.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import Page from '../common/Page'; import Bubble from '../common/Bubble'; @@ -40,16 +40,16 @@ class GetCenter extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} style={styles.mapView}> - - + Center diff --git a/example/src/examples/Camera/GetZoom.js b/example/src/examples/Camera/GetZoom.js index 1b1efdd9..06052ff3 100755 --- a/example/src/examples/Camera/GetZoom.js +++ b/example/src/examples/Camera/GetZoom.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import Page from '../common/Page'; import Bubble from '../common/Bubble'; @@ -28,16 +28,16 @@ class GetZoom extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} style={styles.mapView}> - - + Current zoom: {this.state.zoom} diff --git a/example/src/examples/Camera/RestrictMapBounds.js b/example/src/examples/Camera/RestrictMapBounds.js index e2c0b361..f1331e76 100644 --- a/example/src/examples/Camera/RestrictMapBounds.js +++ b/example/src/examples/Camera/RestrictMapBounds.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import bboxPolygon from '@turf/bbox-polygon'; import sheet from '../../styles/sheet'; @@ -20,18 +20,18 @@ const polygon = bboxPolygon([sw[0], sw[1], ne[0], ne[1]]); const RestrictMapBounds = props => ( - - + - - - - + + + + ); diff --git a/example/src/examples/Camera/SetHeading.js b/example/src/examples/Camera/SetHeading.js index 05831ccf..f3ce5a96 100755 --- a/example/src/examples/Camera/SetHeading.js +++ b/example/src/examples/Camera/SetHeading.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import TabBarPage from '../common/TabBarPage'; @@ -25,7 +25,7 @@ class SetHeading extends React.Component { } componentDidMount() { - MapLibreGL.locationManager.start(); + VietmapGL.locationManager.start(); } componentDidUpdate() { @@ -35,7 +35,7 @@ class SetHeading extends React.Component { } componentWillUnmount() { - MapLibreGL.locationManager.stop(); + VietmapGL.locationManager.stop(); } onHeadingChange(index, heading) { @@ -48,12 +48,12 @@ class SetHeading extends React.Component { {...this.props} options={this._bearingOptions} onOptionPress={this.onHeadingChange}> - (this.map = ref)} style={sheet.matchParent}> - - - + + + ); } diff --git a/example/src/examples/Camera/SetPitch.js b/example/src/examples/Camera/SetPitch.js index 8e87b791..f5b66f01 100755 --- a/example/src/examples/Camera/SetPitch.js +++ b/example/src/examples/Camera/SetPitch.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import TabBarPage from '../common/TabBarPage'; @@ -24,11 +24,11 @@ class SetPitch extends React.Component { } componentDidMount() { - MapLibreGL.locationManager.start(); + VietmapGL.locationManager.start(); } componentWillUnmount() { - MapLibreGL.locationManager.stop(); + VietmapGL.locationManager.stop(); } onUpdatePitch(index, pitch) { @@ -41,10 +41,10 @@ class SetPitch extends React.Component { {...this.props} options={this._pitchOptions} onOptionPress={this.onUpdatePitch}> - - - - + + + + ); } diff --git a/example/src/examples/Camera/SetUserTrackingModes.js b/example/src/examples/Camera/SetUserTrackingModes.js index e113fd5a..b69a4183 100755 --- a/example/src/examples/Camera/SetUserTrackingModes.js +++ b/example/src/examples/Camera/SetUserTrackingModes.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import {onSortOptions} from '../../utils'; @@ -17,11 +17,11 @@ class SetUserTrackingModes extends React.Component { constructor(props) { super(props); - this._trackingOptions = Object.keys(MapLibreGL.UserTrackingModes) + this._trackingOptions = Object.keys(VietmapGL.UserTrackingModes) .map(key => { return { label: key, - data: MapLibreGL.UserTrackingModes[key], + data: VietmapGL.UserTrackingModes[key], }; }) .concat([ @@ -69,11 +69,11 @@ class SetUserTrackingModes extends React.Component { get userTrackingModeText() { switch (this.state.currentTrackingMode) { - case MapLibreGL.UserTrackingModes.Follow: + case VietmapGL.UserTrackingModes.Follow: return 'Follow'; - case MapLibreGL.UserTrackingModes.FollowWithCourse: + case VietmapGL.UserTrackingModes.FollowWithCourse: return 'FollowWithCourse'; - case MapLibreGL.UserTrackingModes.FollowWithHeading: + case VietmapGL.UserTrackingModes.FollowWithHeading: return 'FollowWithHeading'; default: return 'None'; @@ -88,13 +88,13 @@ class SetUserTrackingModes extends React.Component { initialIndex={3} options={this._trackingOptions} onOptionPress={this.onTrackingChange}> - - + - - + User Tracking Mode: {this.userTrackingModeText} diff --git a/example/src/examples/Camera/TakeSnapshot.js b/example/src/examples/Camera/TakeSnapshot.js index f65b34f3..ddc841e9 100755 --- a/example/src/examples/Camera/TakeSnapshot.js +++ b/example/src/examples/Camera/TakeSnapshot.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import { View, Image, @@ -38,14 +38,14 @@ class TakeSnapshot extends React.Component { async takeSnapshot() { const {width, height} = Dimensions.get('window'); - const uri = await MapLibreGL.snapshotManager.takeSnap({ + const uri = await VietmapGL.snapshotManager.takeSnap({ centerCoordinate: [-74.12641, 40.797968], width, height, zoomLevel: 3, pitch: 30, heading: 20, - styleURL: MapLibreGL.StyleURL.Default, + styleURL: VietmapGL.StyleURL.Default, writeToDisk: true, }); diff --git a/example/src/examples/Camera/TakeSnapshotWithMap.js b/example/src/examples/Camera/TakeSnapshotWithMap.js index 1c65c837..7ed5f30d 100755 --- a/example/src/examples/Camera/TakeSnapshotWithMap.js +++ b/example/src/examples/Camera/TakeSnapshotWithMap.js @@ -1,6 +1,6 @@ import React from 'react'; import {StyleSheet, View, Text, TouchableOpacity, Image} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import colors from '../../styles/colors'; @@ -39,13 +39,13 @@ class TakeSnapshotWithMap extends React.Component { return ( - (this.map = ref)} style={styles.map}> - (this.map = ref)} style={styles.map}> + - + {this.state.uri ? ( diff --git a/example/src/examples/Camera/YoYo.js b/example/src/examples/Camera/YoYo.js index 7b46c5ff..d93db304 100755 --- a/example/src/examples/Camera/YoYo.js +++ b/example/src/examples/Camera/YoYo.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import {SF_OFFICE_COORDINATE} from '../../utils'; @@ -37,15 +37,15 @@ class YoYo extends React.Component { render() { return ( - (this.map = ref)} style={sheet.matchParent} - styleURL={MapLibreGL.StyleURL.Default}> - + - + ); } diff --git a/example/src/examples/FillRasterLayer/ChoroplethLayerByZoomLevel.js b/example/src/examples/FillRasterLayer/ChoroplethLayerByZoomLevel.js index d1b513ee..544816ba 100755 --- a/example/src/examples/FillRasterLayer/ChoroplethLayerByZoomLevel.js +++ b/example/src/examples/FillRasterLayer/ChoroplethLayerByZoomLevel.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import Page from '../common/Page'; @@ -65,19 +65,19 @@ const styles = { function ChoroplethLayerByZoomLevel() { return ( - - - - - - - + + ); } diff --git a/example/src/examples/FillRasterLayer/CustomVectorSource.js b/example/src/examples/FillRasterLayer/CustomVectorSource.js index 1cb4cb30..e088cd28 100755 --- a/example/src/examples/FillRasterLayer/CustomVectorSource.js +++ b/example/src/examples/FillRasterLayer/CustomVectorSource.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {Text} from 'react-native'; import sheet from '../../styles/sheet'; @@ -41,13 +41,13 @@ class CustomVectorSource extends React.PureComponent { const {featuresCount} = this.state; return ( - - + - { @@ -56,13 +56,13 @@ class CustomVectorSource extends React.PureComponent { onPress={e => { console.log(`VectorSource onPress: ${e.features}`, e.features); }}> - - - + + Query features: {featuresCount && Count: {featuresCount}} diff --git a/example/src/examples/FillRasterLayer/GeoJSONSource.js b/example/src/examples/FillRasterLayer/GeoJSONSource.js index 74b5204e..ecda12c1 100755 --- a/example/src/examples/FillRasterLayer/GeoJSONSource.js +++ b/example/src/examples/FillRasterLayer/GeoJSONSource.js @@ -1,5 +1,5 @@ import React, {useState} from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import gridPattern from '../../assets/grid_pattern.png'; @@ -21,29 +21,29 @@ function GeoJSONSource() { const [mapRef, setMapRef] = useState(null); return ( - - + - - + - + - - + - - + + ); } diff --git a/example/src/examples/FillRasterLayer/ImageOverlay.js b/example/src/examples/FillRasterLayer/ImageOverlay.js index b015c49c..e0974958 100755 --- a/example/src/examples/FillRasterLayer/ImageOverlay.js +++ b/example/src/examples/FillRasterLayer/ImageOverlay.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {Text} from 'react-native'; import Bubble from '../common/Bubble'; @@ -76,23 +76,23 @@ class ImageOverlay extends React.Component { : 'Dynamic coordinates'; return ( - (this.map = ref)} style={sheet.matchParent} - styleURL={MapLibreGL.StyleURL.Default}> - + styleURL={VietmapGL.StyleURL.Default}> + - - - - + + { this.setState({dynamic: !this.state.dynamic}); diff --git a/example/src/examples/FillRasterLayer/IndoorBuilding.js b/example/src/examples/FillRasterLayer/IndoorBuilding.js index 8fcdc1bf..7d8c0958 100755 --- a/example/src/examples/FillRasterLayer/IndoorBuilding.js +++ b/example/src/examples/FillRasterLayer/IndoorBuilding.js @@ -1,6 +1,6 @@ import React from 'react'; import {View, StyleSheet} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {Slider} from 'react-native-elements'; import sheet from '../../styles/sheet'; @@ -46,29 +46,29 @@ class IndoorBuilding extends React.Component { render() { return ( - (this.map = ref)} style={sheet.matchParent}> - - - - - - + + - (this._map = c)} onPress={this.onPress} style={sheet.matchParent} - styleURL={MapLibreGL.StyleURL.Default}> - + - - - + + + {this.state.selectedGeoJSON ? ( - - - + ) : null} - + Press on a feature to highlight it. diff --git a/example/src/examples/FillRasterLayer/QueryWithRect.js b/example/src/examples/FillRasterLayer/QueryWithRect.js index b26237ae..39521bfc 100755 --- a/example/src/examples/FillRasterLayer/QueryWithRect.js +++ b/example/src/examples/FillRasterLayer/QueryWithRect.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import nycJSON from '../../assets/nyc_geojson.json'; @@ -76,31 +76,31 @@ class QueryWithRect extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} style={sheet.matchParent} - styleURL={MapLibreGL.StyleURL.Default}> - + - - - + + + {this.state.selectedGeoJSON ? ( - - - + ) : null} - + {this.message} diff --git a/example/src/examples/FillRasterLayer/WatercolorRasterTiles.js b/example/src/examples/FillRasterLayer/WatercolorRasterTiles.js index 454f248b..325f180f 100755 --- a/example/src/examples/FillRasterLayer/WatercolorRasterTiles.js +++ b/example/src/examples/FillRasterLayer/WatercolorRasterTiles.js @@ -1,6 +1,6 @@ import React from 'react'; import {View, StyleSheet} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {Slider} from 'react-native-elements'; import sheet from '../../styles/sheet'; @@ -44,20 +44,20 @@ class WatercolorRasterTiles extends React.Component { return ( - - + - - + - - + + - - + - - - - + + + ); } diff --git a/example/src/examples/Map/ChangeLayerColor.js b/example/src/examples/Map/ChangeLayerColor.js index be7bd2fe..f722baf3 100644 --- a/example/src/examples/Map/ChangeLayerColor.js +++ b/example/src/examples/Map/ChangeLayerColor.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import Page from '../common/Page'; import Bubble from '../common/Bubble'; @@ -28,18 +28,18 @@ class ChangeLayerColor extends React.Component { const {backgroundColor} = this.state; return ( - (this._map = c)} onPress={this.onPress} style={styles.mapView}> - + {!!backgroundColor && ( - )} - + Paint Water diff --git a/example/src/examples/Map/CreateOfflineRegion.js b/example/src/examples/Map/CreateOfflineRegion.js index 7b9cc5c0..8f2215a7 100755 --- a/example/src/examples/Map/CreateOfflineRegion.js +++ b/example/src/examples/Map/CreateOfflineRegion.js @@ -7,7 +7,7 @@ import { Dimensions, StyleSheet, } from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import geoViewport from '@mapbox/geo-viewport'; import sheet from '../../styles/sheet'; @@ -57,8 +57,8 @@ class CreateOfflineRegion extends React.Component { componentWillUnmount() { // avoid setState warnings if we back out before we finishing downloading - MapLibreGL.offlineManager.deletePack(this.state.name); - MapLibreGL.offlineManager.unsubscribe('test'); + VietmapGL.offlineManager.deletePack(this.state.name); + VietmapGL.offlineManager.unsubscribe('test'); } async onDidFinishLoadingStyle() { @@ -72,7 +72,7 @@ class CreateOfflineRegion extends React.Component { const options = { name: this.state.name, - styleURL: MapLibreGL.StyleURL.Default, + styleURL: VietmapGL.StyleURL.Default, bounds: [ [bounds[0], bounds[1]], [bounds[2], bounds[3]], @@ -82,7 +82,7 @@ class CreateOfflineRegion extends React.Component { }; // start download - MapLibreGL.offlineManager.createPack(options, this.onDownloadProgress); + VietmapGL.offlineManager.createPack(options, this.onDownloadProgress); } onDownloadProgress(offlineRegion, offlineRegionStatus) { @@ -121,9 +121,9 @@ class CreateOfflineRegion extends React.Component { _getRegionDownloadState(downloadState) { switch (downloadState) { - case MapLibreGL.OfflinePackDownloadState.Active: + case VietmapGL.OfflinePackDownloadState.Active: return 'Active'; - case MapLibreGL.OfflinePackDownloadState.Complete: + case VietmapGL.OfflinePackDownloadState.Complete: return 'Complete'; default: return 'Inactive'; @@ -135,13 +135,13 @@ class CreateOfflineRegion extends React.Component { return ( - (this._map = c)} onPress={this.onPress} onDidFinishLoadingMap={this.onDidFinishLoadingStyle} style={sheet.matchParent}> - - + + {offlineRegionStatus !== null ? ( diff --git a/example/src/examples/Map/PointInMapView.js b/example/src/examples/Map/PointInMapView.js index b8c40d53..051d3cbf 100755 --- a/example/src/examples/Map/PointInMapView.js +++ b/example/src/examples/Map/PointInMapView.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import Page from '../common/Page'; import Bubble from '../common/Bubble'; @@ -39,15 +39,15 @@ class PointInMapView extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} style={styles.mapView}> - - + {this.renderPointInView()} diff --git a/example/src/examples/Map/ShowAndHideLayer.js b/example/src/examples/Map/ShowAndHideLayer.js index fa7e4503..40bcdd38 100644 --- a/example/src/examples/Map/ShowAndHideLayer.js +++ b/example/src/examples/Map/ShowAndHideLayer.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import Page from '../common/Page'; import Bubble from '../common/Bubble'; @@ -29,13 +29,13 @@ class ShowAndHideLayer extends React.Component { const visibility = this.state.show ? 'visible' : 'none'; return ( - (this._map = c)} onPress={this.onPress} style={styles.mapView}> - - - + + + {this.state.show ? 'Hide Country Labels' : 'Show Country Labels'} diff --git a/example/src/examples/Map/ShowClick.js b/example/src/examples/Map/ShowClick.js index 6e6132e4..8b03019f 100755 --- a/example/src/examples/Map/ShowClick.js +++ b/example/src/examples/Map/ShowClick.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import {DEFAULT_CENTER_COORDINATE} from '../../utils'; @@ -61,9 +61,9 @@ class ShowClick extends React.Component { render() { return ( - - - + + + {this.renderLastClicked()} ); diff --git a/example/src/examples/Map/ShowMap.tsx b/example/src/examples/Map/ShowMap.tsx index 4e57cd1b..93a7973b 100755 --- a/example/src/examples/Map/ShowMap.tsx +++ b/example/src/examples/Map/ShowMap.tsx @@ -1,17 +1,17 @@ import React, {useState, useEffect, ReactElement} from 'react'; import {Alert} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import {onSortOptions} from '../../utils'; import TabBarPage from '../common/TabBarPage'; const ShowMap = (): ReactElement => { - const _mapOptions = Object.keys(MapLibreGL.StyleURL) + const _mapOptions = Object.keys(VietmapGL.StyleURL) .map(key => { return { label: key, - data: (MapLibreGL.StyleURL as any)[key], // bad any, because enums + data: (VietmapGL.StyleURL as any)[key], // bad any, because enums }; }) .sort(onSortOptions); @@ -19,16 +19,16 @@ const ShowMap = (): ReactElement => { const [styleURL, setStyleURL] = useState({styleURL: _mapOptions[0].data}); useEffect(() => { - MapLibreGL.locationManager.start(); + VietmapGL.locationManager.start(); return (): void => { - MapLibreGL.locationManager.stop(); + VietmapGL.locationManager.stop(); }; }, []); const onMapChange = ( index: number, - newStyleURL: MapLibreGL.StyleURL, + newStyleURL: VietmapGL.StyleURL, ): void => { setStyleURL({styleURL: newStyleURL}); }; @@ -39,13 +39,13 @@ const ShowMap = (): ReactElement => { return ( - - + - - + + ); }; diff --git a/example/src/examples/Map/ShowMapLocalStyle.tsx b/example/src/examples/Map/ShowMapLocalStyle.tsx index ef775b4f..6fa85823 100644 --- a/example/src/examples/Map/ShowMapLocalStyle.tsx +++ b/example/src/examples/Map/ShowMapLocalStyle.tsx @@ -1,6 +1,6 @@ import React, {FC, useEffect} from 'react'; import {Alert} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import Page from '../common/Page'; @@ -10,10 +10,10 @@ const style = JSON.stringify(require('../../assets/map-styleURL-style.json')); const ShowMap: FC = props => { useEffect(() => { - MapLibreGL.locationManager.start(); + VietmapGL.locationManager.start(); return (): void => { - MapLibreGL.locationManager.stop(); + VietmapGL.locationManager.stop(); }; }, []); @@ -23,10 +23,10 @@ const ShowMap: FC = props => { return ( - - - - + + + + ); }; diff --git a/example/src/examples/Map/ShowRegionDidChange.js b/example/src/examples/Map/ShowRegionDidChange.js index 2817aa1a..a0bd2826 100644 --- a/example/src/examples/Map/ShowRegionDidChange.js +++ b/example/src/examples/Map/ShowRegionDidChange.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import {DEFAULT_CENTER_COORDINATE, SF_OFFICE_COORDINATE} from '../../utils'; @@ -52,7 +52,7 @@ class ShowRegionDidChange extends React.Component { cameraConfig: { triggerKey: Date.now(), centerCoordinate: optionData, - animationMode: MapLibreGL.Camera.Mode.Flight, + animationMode: VietmapGL.Camera.Mode.Flight, animationDuration: 2000, }, }); @@ -130,14 +130,14 @@ class ShowRegionDidChange extends React.Component { {...this.props} options={this._tabOptions} onOptionPress={this.onOptionPress}> - (this.map = c)} style={sheet.matchParent} onRegionWillChange={this.onRegionWillChange} onRegionIsChanging={this.onRegionIsChanging} onRegionDidChange={this.onRegionDidChange}> - - + + {this.renderRegionChange()} ); diff --git a/example/src/examples/Map/SourceLayerVisibility.js b/example/src/examples/Map/SourceLayerVisibility.js index c50405e4..31591490 100755 --- a/example/src/examples/Map/SourceLayerVisibility.js +++ b/example/src/examples/Map/SourceLayerVisibility.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import Page from '../common/Page'; import Bubble from '../common/Bubble'; @@ -33,12 +33,12 @@ class SourceLayerVisibility extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} style={styles.mapView}> - - + + {`${ this.state.show ? 'Hide' : 'Show' diff --git a/example/src/examples/Map/StyleJson.js b/example/src/examples/Map/StyleJson.js index a3656c15..90162ab5 100755 --- a/example/src/examples/Map/StyleJson.js +++ b/example/src/examples/Map/StyleJson.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text, StyleSheet} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import StyleJsonExample from '../../assets/style-json-example.json'; import StyleJsonExample2 from '../../assets/style-json-example2.json'; @@ -33,16 +33,16 @@ class StyleJson extends React.Component { render() { return ( - - - + - + {this.state.showAltStyle ? 'Style 2' : 'Style 1'} diff --git a/example/src/examples/Map/TwoByTwo.js b/example/src/examples/Map/TwoByTwo.js index 1bf8d208..98f36141 100755 --- a/example/src/examples/Map/TwoByTwo.js +++ b/example/src/examples/Map/TwoByTwo.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import smileyFaceGeoJSON from '../../assets/smiley_face.json'; @@ -21,17 +21,17 @@ const layerStyles = { class TwoByTwo extends React.Component { renderMap(styleURL, layerStyle) { return ( - (this.map = ref)} style={sheet.matchParent} styleURL={styleURL}> - - - - + + + + ); } @@ -39,11 +39,11 @@ class TwoByTwo extends React.Component { return ( {this.renderMap( - MapLibreGL.StyleURL.Default, + VietmapGL.StyleURL.Default, layerStyles.smileyFaceDark, )} {this.renderMap( - MapLibreGL.StyleURL.Default, + VietmapGL.StyleURL.Default, layerStyles.smileyFaceLight, )} diff --git a/example/src/examples/SymbolCircleLayer/CustomIcon.js b/example/src/examples/SymbolCircleLayer/CustomIcon.js index 5d67751e..a61453c0 100755 --- a/example/src/examples/SymbolCircleLayer/CustomIcon.js +++ b/example/src/examples/SymbolCircleLayer/CustomIcon.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {featureCollection, feature} from '@turf/helpers'; import sheet from '../../styles/sheet'; @@ -51,27 +51,27 @@ class CustomIcon extends React.Component { render() { return ( - (this._map = c)} onPress={this.onPress} style={sheet.matchParent}> - - - - - + + Tap to add an icon diff --git a/example/src/examples/SymbolCircleLayer/DataDrivenCircleColors.js b/example/src/examples/SymbolCircleLayer/DataDrivenCircleColors.js index ca77f837..d284c636 100755 --- a/example/src/examples/SymbolCircleLayer/DataDrivenCircleColors.js +++ b/example/src/examples/SymbolCircleLayer/DataDrivenCircleColors.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import Page from '../common/Page'; @@ -35,25 +35,25 @@ const styles = { function DataDrivenCircleColors() { return ( - - - - - - + + ); } diff --git a/example/src/examples/SymbolCircleLayer/EarthQuakes.js b/example/src/examples/SymbolCircleLayer/EarthQuakes.js index 5f0851c3..06824454 100755 --- a/example/src/examples/SymbolCircleLayer/EarthQuakes.js +++ b/example/src/examples/SymbolCircleLayer/EarthQuakes.js @@ -1,7 +1,7 @@ import React from 'react'; import {FlatList} from 'react-native'; import {Overlay, ListItem, FAB, Icon} from 'react-native-elements'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import moment from 'moment'; import earthQuakesJSON from '../../assets/earthquakes.json'; @@ -124,16 +124,16 @@ class EarthQuakes extends React.Component { )} - - + - { const cluster = shape.features[0]; @@ -172,25 +172,25 @@ class EarthQuakes extends React.Component { ], }} shape={earthQuakesJSON}> - - - - - + + ); diff --git a/example/src/examples/SymbolCircleLayer/ShapeSourceIcon.js b/example/src/examples/SymbolCircleLayer/ShapeSourceIcon.js index fbcf4761..76b61184 100755 --- a/example/src/examples/SymbolCircleLayer/ShapeSourceIcon.js +++ b/example/src/examples/SymbolCircleLayer/ShapeSourceIcon.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import exampleIcon from '../../assets/example.png'; @@ -84,12 +84,12 @@ class ShapeSourceIcon extends React.Component { return ( - - + - @@ -98,12 +98,12 @@ class ShapeSourceIcon extends React.Component { }) } /> - - - - + + + ); } diff --git a/example/src/examples/UserLocation/SetDisplacement.js b/example/src/examples/UserLocation/SetDisplacement.js index 8be6d255..ffcbbe72 100644 --- a/example/src/examples/UserLocation/SetDisplacement.js +++ b/example/src/examples/UserLocation/SetDisplacement.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import TabBarPage from '../common/TabBarPage'; @@ -11,11 +11,11 @@ class SetDisplacement extends React.Component { state = {minDisplacement: DISPLACEMENT[0]}; componentDidMount() { - MapLibreGL.locationManager.start(); + VietmapGL.locationManager.start(); } componentWillUnmount() { - MapLibreGL.locationManager.stop(); + VietmapGL.locationManager.stop(); } onDisplacementChange = index => { @@ -28,17 +28,17 @@ class SetDisplacement extends React.Component { {...this.props} options={OPTIONS} onOptionPress={this.onDisplacementChange}> - - + - - + ); } diff --git a/example/src/examples/UserLocation/SetTintColor.js b/example/src/examples/UserLocation/SetTintColor.js index 8ee5f5a6..48740ca8 100644 --- a/example/src/examples/UserLocation/SetTintColor.js +++ b/example/src/examples/UserLocation/SetTintColor.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import TabBarPage from '../common/TabBarPage'; @@ -20,20 +20,20 @@ class SetTintColor extends React.Component { {...this.props} options={OPTIONS} onOptionPress={this.onTintColorChange}> - - - - + ); } diff --git a/example/src/examples/UserLocation/SetUserLocationRenderMode.js b/example/src/examples/UserLocation/SetUserLocationRenderMode.js index 200af52c..241c61a0 100755 --- a/example/src/examples/UserLocation/SetUserLocationRenderMode.js +++ b/example/src/examples/UserLocation/SetUserLocationRenderMode.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import {Button, View} from 'react-native'; import {ButtonGroup} from 'react-native-elements'; import PropTypes from 'prop-types'; @@ -123,19 +123,19 @@ class SetUserLocationRenderMode extends React.Component { settings={this.state} onUpdateSettings={settings => this.setState(settings)} /> - - + {this.state.renderMode !== 'hidden' && ( - )} - + ); } diff --git a/example/src/examples/UserLocation/SetUserLocationVerticalAlignment.js b/example/src/examples/UserLocation/SetUserLocationVerticalAlignment.js index fcca72bd..e09c6f43 100755 --- a/example/src/examples/UserLocation/SetUserLocationVerticalAlignment.js +++ b/example/src/examples/UserLocation/SetUserLocationVerticalAlignment.js @@ -1,5 +1,5 @@ import React from 'react'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import TabBarPage from '../common/TabBarPage'; @@ -42,12 +42,12 @@ class SetUserLocationVerticalAlignment extends React.Component { {...this.props} options={this._alignmentOptions} onOptionPress={this.onAlignmentChange}> - - - - + + + ); } diff --git a/example/src/examples/UserLocation/UserLocationChange.js b/example/src/examples/UserLocation/UserLocationChange.js index bbed4981..7cc5aae0 100755 --- a/example/src/examples/UserLocation/UserLocationChange.js +++ b/example/src/examples/UserLocation/UserLocationChange.js @@ -1,6 +1,6 @@ import React from 'react'; import {Text} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; import sheet from '../../styles/sheet'; import Page from '../common/Page'; @@ -55,17 +55,17 @@ class UserLocationChange extends React.Component { render() { return ( - - + - - + {this.renderLocationInfo()} ); diff --git a/example/src/examples/common/PulseCircleLayer.js b/example/src/examples/common/PulseCircleLayer.js index e2affdcb..2389130b 100755 --- a/example/src/examples/common/PulseCircleLayer.js +++ b/example/src/examples/common/PulseCircleLayer.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import {Animated} from 'react-native'; -import MapLibreGL from '@maplibre/maplibre-react-native'; +import VietmapGL from '@maplibre/maplibre-react-native'; const styles = { innerCircle: { @@ -122,25 +122,25 @@ class PulseCircleLayer extends React.Component { ]; return ( - - - - - + ); } } diff --git a/example/yarn.lock b/example/yarn.lock index 9ec1874b..726a5741 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -2274,9 +2274,9 @@ __metadata: languageName: node linkType: hard -"RNMaplibreExample@workspace:.": +"RNVietmapExample@workspace:.": version: 0.0.0-use.local - resolution: "RNMaplibreExample@workspace:." + resolution: "RNVietmapExample@workspace:." dependencies: "@babel/core": ^7.20.5 "@babel/preset-typescript": 7.22.5 diff --git a/javascript/Maplibre.ts b/javascript/Vietmap.ts similarity index 98% rename from javascript/Maplibre.ts rename to javascript/Vietmap.ts index 97a3308a..8e57a354 100644 --- a/javascript/Maplibre.ts +++ b/javascript/Vietmap.ts @@ -52,7 +52,7 @@ export type { HillshadeLayerStyleProps as HillshadeLayerStyle, BackgroundLayerStyleProps as BackgroundLayerStyle, LightLayerStyleProps as LightLayerStyle, -} from './utils/MaplibreStyles'; +} from './utils/VietmapStyles'; import {UserTrackingMode} from './components/Camera'; diff --git a/javascript/components/AbstractLayer.tsx b/javascript/components/AbstractLayer.tsx index cd1962dd..b6d2f76f 100644 --- a/javascript/components/AbstractLayer.tsx +++ b/javascript/components/AbstractLayer.tsx @@ -1,7 +1,7 @@ /* eslint react/prop-types:0 */ import {StyleValue, transformStyle} from '../utils/StyleValue'; import {getFilter} from '../utils/filterUtils'; -import {AllLayerStyleProps, FilterExpression} from '../utils/MaplibreStyles'; +import {AllLayerStyleProps, FilterExpression} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import React from 'react'; diff --git a/javascript/components/BackgroundLayer.tsx b/javascript/components/BackgroundLayer.tsx index 8b2ced25..a074fbae 100644 --- a/javascript/components/BackgroundLayer.tsx +++ b/javascript/components/BackgroundLayer.tsx @@ -1,4 +1,4 @@ -import {BackgroundLayerStyleProps} from '../utils/MaplibreStyles'; +import {BackgroundLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactNode} from 'react'; import {NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLBackgroundLayer'; @@ -23,7 +23,7 @@ interface NativeProps class BackgroundLayer extends AbstractLayer { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; render(): ReactNode { diff --git a/javascript/components/Camera.tsx b/javascript/components/Camera.tsx index 04840993..c19c4166 100644 --- a/javascript/components/Camera.tsx +++ b/javascript/components/Camera.tsx @@ -10,7 +10,7 @@ import { } from 'react-native'; import React, {Component, MutableRefObject, ReactElement} from 'react'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLCamera'; @@ -152,7 +152,7 @@ interface CameraProps extends Omit, CameraStop { followUserLocation?: boolean; /** - * The mode used to track the user location on the map. One of; "normal", "compass", "course". Each mode string is also available as a member on the `MapLibreGL.UserTrackingModes` object. `Follow` (normal), `FollowWithHeading` (compass), `FollowWithCourse` (course). NOTE: `followUserLocation` must be set to `true` for any of the modes to take effect. [Example](../example/src/examples/Camera/SetUserTrackingModes.js) + * The mode used to track the user location on the map. One of; "normal", "compass", "course". Each mode string is also available as a member on the `VietmapGL.UserTrackingModes` object. `Follow` (normal), `FollowWithHeading` (compass), `FollowWithCourse` (course). NOTE: `followUserLocation` must be set to `true` for any of the modes to take effect. [Example](../example/src/examples/Camera/SetUserTrackingModes.js) */ followUserMode?: UserTrackingMode; @@ -630,13 +630,13 @@ class Camera extends React.Component { _getNativeCameraMode(config: CameraStop): NativeAnimationMode { switch (config.animationMode) { case 'flyTo': - return MapLibreGL.CameraModes.Flight; + return VietmapGL.CameraModes.Flight; case 'moveTo': - return MapLibreGL.CameraModes.None; + return VietmapGL.CameraModes.None; case 'linearTo': - return MapLibreGL.CameraModes.Linear; + return VietmapGL.CameraModes.Linear; default: - return MapLibreGL.CameraModes.Ease; + return VietmapGL.CameraModes.Ease; } } diff --git a/javascript/components/CircleLayer.tsx b/javascript/components/CircleLayer.tsx index 48582119..ea397cad 100644 --- a/javascript/components/CircleLayer.tsx +++ b/javascript/components/CircleLayer.tsx @@ -1,4 +1,4 @@ -import {CircleLayerStyleProps} from '../utils/MaplibreStyles'; +import {CircleLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactElement} from 'react'; import {NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLCircleLayer'; @@ -26,7 +26,7 @@ interface NativeProps */ class CircleLayer extends AbstractLayer { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; render(): ReactElement { diff --git a/javascript/components/FillExtrusionLayer.tsx b/javascript/components/FillExtrusionLayer.tsx index 5107d8ca..c089cd6a 100644 --- a/javascript/components/FillExtrusionLayer.tsx +++ b/javascript/components/FillExtrusionLayer.tsx @@ -1,4 +1,4 @@ -import {FillExtrusionLayerStyleProps} from '../utils/MaplibreStyles'; +import {FillExtrusionLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactElement} from 'react'; import {NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLFillExtrusionLayer'; @@ -29,7 +29,7 @@ class FillExtrusionLayer extends AbstractLayer< NativeProps > { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; render(): ReactElement { diff --git a/javascript/components/FillLayer.tsx b/javascript/components/FillLayer.tsx index 8d3211bb..8ec62227 100644 --- a/javascript/components/FillLayer.tsx +++ b/javascript/components/FillLayer.tsx @@ -1,4 +1,4 @@ -import {FillLayerStyleProps} from '../utils/MaplibreStyles'; +import {FillLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactElement} from 'react'; import {NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLFillLayer'; @@ -24,7 +24,7 @@ interface NativeProps extends Omit, NativeBaseProps {} */ class FillLayer extends AbstractLayer { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; render(): ReactElement { diff --git a/javascript/components/HeatmapLayer.tsx b/javascript/components/HeatmapLayer.tsx index b60e1ebc..cbe6136e 100644 --- a/javascript/components/HeatmapLayer.tsx +++ b/javascript/components/HeatmapLayer.tsx @@ -1,4 +1,4 @@ -import {HeatmapLayerStyleProps} from '../utils/MaplibreStyles'; +import {HeatmapLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactElement} from 'react'; import {NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLHeatmapLayer'; @@ -26,7 +26,7 @@ interface NativeProps */ class HeatmapLayer extends AbstractLayer { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; render(): ReactElement { diff --git a/javascript/components/Light.tsx b/javascript/components/Light.tsx index e75ec6b0..25fef3cb 100644 --- a/javascript/components/Light.tsx +++ b/javascript/components/Light.tsx @@ -1,4 +1,4 @@ -import {LightLayerStyleProps} from '../utils/MaplibreStyles'; +import {LightLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import {StyleValue, transformStyle} from '../utils/StyleValue'; diff --git a/javascript/components/LineLayer.tsx b/javascript/components/LineLayer.tsx index b1a5447f..bb4908ab 100644 --- a/javascript/components/LineLayer.tsx +++ b/javascript/components/LineLayer.tsx @@ -1,4 +1,4 @@ -import {LineLayerStyleProps} from '../utils/MaplibreStyles'; +import {LineLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactElement} from 'react'; import {NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLLineLayer'; @@ -24,7 +24,7 @@ interface NativeProps extends Omit, NativeBaseProps {} */ class LineLayer extends AbstractLayer { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; render(): ReactElement { diff --git a/javascript/components/MapView.tsx b/javascript/components/MapView.tsx index 275b5c6a..2c584cb4 100644 --- a/javascript/components/MapView.tsx +++ b/javascript/components/MapView.tsx @@ -1,4 +1,4 @@ -import {FilterExpression} from '../utils/MaplibreStyles'; +import {FilterExpression} from '../utils/VietmapStyles'; import {Location} from '../modules/location/locationManager'; import {isFunction, isAndroid} from '../utils'; import {getFilter} from '../utils/filterUtils'; @@ -20,8 +20,8 @@ import { } from 'react-native'; import {debounce} from 'debounce'; -const MapLibreGL = NativeModules.MGLModule; -if (MapLibreGL == null) { +const VietmapGL = NativeModules.MGLModule; +if (VietmapGL == null) { console.error( 'Native part of Mapbox React Native libraries were not registered properly, double check our native installation guides.', ); @@ -35,7 +35,7 @@ const styles = StyleSheet.create({ matchParent: {flex: 1}, }); -const defaultStyleURL = MapLibreGL.StyleURL.Street; +const defaultStyleURL = VietmapGL.StyleURL.Street; export interface RegionPayload { zoomLevel: number; @@ -61,7 +61,7 @@ interface MapViewProps extends BaseProps { */ style?: ViewProps['style']; /** - * Style URL for map - notice, if non is set it _will_ default to `MapLibreGL.StyleURL.Default` + * Style URL for map - notice, if non is set it _will_ default to `VietmapGL.StyleURL.Default` */ styleURL?: string; /** @@ -353,46 +353,46 @@ class MapView extends NativeBridgeComponent( const events = []; if (props.onRegionWillChange) { - events.push(MapLibreGL.EventTypes.RegionWillChange); + events.push(VietmapGL.EventTypes.RegionWillChange); } if (props.onRegionIsChanging) { - events.push(MapLibreGL.EventTypes.RegionIsChanging); + events.push(VietmapGL.EventTypes.RegionIsChanging); } if (props.onRegionDidChange) { - events.push(MapLibreGL.EventTypes.RegionDidChange); + events.push(VietmapGL.EventTypes.RegionDidChange); } if (props.onUserLocationUpdate) { - events.push(MapLibreGL.EventTypes.UserLocationUpdated); + events.push(VietmapGL.EventTypes.UserLocationUpdated); } if (props.onWillStartLoadingMap) { - events.push(MapLibreGL.EventTypes.WillStartLoadingMap); + events.push(VietmapGL.EventTypes.WillStartLoadingMap); } if (props.onDidFinishLoadingMap) { - events.push(MapLibreGL.EventTypes.DidFinishLoadingMap); + events.push(VietmapGL.EventTypes.DidFinishLoadingMap); } if (props.onDidFailLoadingMap) { - events.push(MapLibreGL.EventTypes.DidFailLoadingMap); + events.push(VietmapGL.EventTypes.DidFailLoadingMap); } if (props.onWillStartRenderingFrame) { - events.push(MapLibreGL.EventTypes.WillStartRenderingFrame); + events.push(VietmapGL.EventTypes.WillStartRenderingFrame); } if (props.onDidFinishRenderingFrame) { - events.push(MapLibreGL.EventTypes.DidFinishRenderingFrame); + events.push(VietmapGL.EventTypes.DidFinishRenderingFrame); } if (props.onDidFinishRenderingFrameFully) { - events.push(MapLibreGL.EventTypes.DidFinishRenderingFrameFully); + events.push(VietmapGL.EventTypes.DidFinishRenderingFrameFully); } if (props.onWillStartRenderingMap) { - events.push(MapLibreGL.EventTypes.WillStartRenderingMap); + events.push(VietmapGL.EventTypes.WillStartRenderingMap); } if (props.onDidFinishRenderingMap) { - events.push(MapLibreGL.EventTypes.DidFinishRenderingMap); + events.push(VietmapGL.EventTypes.DidFinishRenderingMap); } if (props.onDidFinishRenderingMapFully) { - events.push(MapLibreGL.EventTypes.DidFinishRenderingMapFully); + events.push(VietmapGL.EventTypes.DidFinishRenderingMapFully); } if (props.onDidFinishLoadingStyle) { - events.push(MapLibreGL.EventTypes.DidFinishLoadingStyle); + events.push(VietmapGL.EventTypes.DidFinishLoadingStyle); } this._runNativeCommand( @@ -652,54 +652,54 @@ class MapView extends NativeBridgeComponent( let propName: CallableProps | undefined; switch (type) { - case MapLibreGL.EventTypes.RegionWillChange: + case VietmapGL.EventTypes.RegionWillChange: if (regionWillChangeDebounceTime && regionWillChangeDebounceTime > 0) { this._onDebouncedRegionWillChange(payload); } else { propName = 'onRegionWillChange'; } break; - case MapLibreGL.EventTypes.RegionIsChanging: + case VietmapGL.EventTypes.RegionIsChanging: propName = 'onRegionIsChanging'; break; - case MapLibreGL.EventTypes.RegionDidChange: + case VietmapGL.EventTypes.RegionDidChange: if (regionDidChangeDebounceTime && regionDidChangeDebounceTime > 0) { this._onDebouncedRegionDidChange(payload); } else { propName = 'onRegionDidChange'; } break; - case MapLibreGL.EventTypes.UserLocationUpdated: + case VietmapGL.EventTypes.UserLocationUpdated: propName = 'onUserLocationUpdate'; break; - case MapLibreGL.EventTypes.WillStartLoadingMap: + case VietmapGL.EventTypes.WillStartLoadingMap: propName = 'onWillStartLoadingMap'; break; - case MapLibreGL.EventTypes.DidFinishLoadingMap: + case VietmapGL.EventTypes.DidFinishLoadingMap: propName = 'onDidFinishLoadingMap'; break; - case MapLibreGL.EventTypes.DidFailLoadingMap: + case VietmapGL.EventTypes.DidFailLoadingMap: propName = 'onDidFailLoadingMap'; break; - case MapLibreGL.EventTypes.WillStartRenderingFrame: + case VietmapGL.EventTypes.WillStartRenderingFrame: propName = 'onWillStartRenderingFrame'; break; - case MapLibreGL.EventTypes.DidFinishRenderingFrame: + case VietmapGL.EventTypes.DidFinishRenderingFrame: propName = 'onDidFinishRenderingFrame'; break; - case MapLibreGL.EventTypes.DidFinishRenderingFrameFully: + case VietmapGL.EventTypes.DidFinishRenderingFrameFully: propName = 'onDidFinishRenderingFrameFully'; break; - case MapLibreGL.EventTypes.WillStartRenderingMap: + case VietmapGL.EventTypes.WillStartRenderingMap: propName = 'onWillStartRenderingMap'; break; - case MapLibreGL.EventTypes.DidFinishRenderingMap: + case VietmapGL.EventTypes.DidFinishRenderingMap: propName = 'onDidFinishRenderingMap'; break; - case MapLibreGL.EventTypes.DidFinishRenderingMapFully: + case VietmapGL.EventTypes.DidFinishRenderingMapFully: propName = 'onDidFinishRenderingMapFully'; break; - case MapLibreGL.EventTypes.DidFinishLoadingStyle: + case VietmapGL.EventTypes.DidFinishLoadingStyle: propName = 'onDidFinishLoadingStyle'; break; default: diff --git a/javascript/components/RasterLayer.tsx b/javascript/components/RasterLayer.tsx index c07e6978..bc69441e 100644 --- a/javascript/components/RasterLayer.tsx +++ b/javascript/components/RasterLayer.tsx @@ -1,4 +1,4 @@ -import {RasterLayerStyleProps} from '../utils/MaplibreStyles'; +import {RasterLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactElement} from 'react'; import {NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLRasterLayer'; @@ -23,7 +23,7 @@ interface NativeProps class RasterLayer extends AbstractLayer { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; render(): ReactElement { diff --git a/javascript/components/RasterSource.tsx b/javascript/components/RasterSource.tsx index 95f0e7d1..f4b6128f 100644 --- a/javascript/components/RasterSource.tsx +++ b/javascript/components/RasterSource.tsx @@ -6,7 +6,7 @@ import AbstractSource from './AbstractSource'; import {NativeModules, requireNativeComponent} from 'react-native'; import React, {ReactElement} from 'react'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLRasterSource'; @@ -67,7 +67,7 @@ type NativeProps = RasterSourceProps; */ class RasterSource extends AbstractSource { static defaultProps = { - id: MapLibreGL.StyleSource.DefaultSourceID, + id: VietmapGL.StyleSource.DefaultSourceID, }; constructor(props: RasterSourceProps) { diff --git a/javascript/components/ShapeSource.tsx b/javascript/components/ShapeSource.tsx index da10996b..6d0c1d46 100644 --- a/javascript/components/ShapeSource.tsx +++ b/javascript/components/ShapeSource.tsx @@ -1,4 +1,4 @@ -import {ExpressionField, FilterExpression} from '../utils/MaplibreStyles'; +import {ExpressionField, FilterExpression} from '../utils/VietmapStyles'; import {getFilter} from '../utils/filterUtils'; import { toJSONString, @@ -22,7 +22,7 @@ import { } from 'react-native'; import {Feature, FeatureCollection} from '@turf/helpers'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLShapeSource'; @@ -140,7 +140,7 @@ class ShapeSource extends NativeBridgeComponent( static NATIVE_ASSETS_KEY = 'assets'; static defaultProps = { - id: MapLibreGL.StyleSource.DefaultSourceID, + id: VietmapGL.StyleSource.DefaultSourceID, }; constructor(props: ShapeSourceProps) { diff --git a/javascript/components/Style.tsx b/javascript/components/Style.tsx index f65ccc18..2cc9feee 100644 --- a/javascript/components/Style.tsx +++ b/javascript/components/Style.tsx @@ -1,4 +1,4 @@ -import {ExpressionField, FilterExpression} from '../utils/MaplibreStyles'; +import {ExpressionField, FilterExpression} from '../utils/VietmapStyles'; import CircleLayer from './CircleLayer'; import RasterLayer from './RasterLayer'; @@ -271,7 +271,7 @@ function asSourceComponent( return getShapeSource(id, source); } - console.warn(`Maplibre source type '${source.type}' is not supported`); + console.warn(`Vietmap source type '${source.type}' is not supported`); return null; } diff --git a/javascript/components/SymbolLayer.tsx b/javascript/components/SymbolLayer.tsx index d3722c2e..3ae66339 100644 --- a/javascript/components/SymbolLayer.tsx +++ b/javascript/components/SymbolLayer.tsx @@ -1,4 +1,4 @@ -import {type SymbolLayerStyleProps} from '../utils/MaplibreStyles'; +import {type SymbolLayerStyleProps} from '../utils/VietmapStyles'; import BaseProps from '../types/BaseProps'; import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; @@ -6,7 +6,7 @@ import AbstractLayer, {BaseLayerProps, NativeBaseProps} from './AbstractLayer'; import React, {ReactElement} from 'react'; import {View, NativeModules, requireNativeComponent} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLSymbolLayer'; @@ -32,7 +32,7 @@ interface NativeProps extends Omit, NativeBaseProps { */ class SymbolLayer extends AbstractLayer { static defaultProps = { - sourceID: MapLibreGL.StyleSource.DefaultSourceID, + sourceID: VietmapGL.StyleSource.DefaultSourceID, }; _shouldSnapshot(): boolean { diff --git a/javascript/components/UserLocation.tsx b/javascript/components/UserLocation.tsx index 108c382e..4b008ac1 100644 --- a/javascript/components/UserLocation.tsx +++ b/javascript/components/UserLocation.tsx @@ -1,5 +1,5 @@ import locationManager, {Location} from '../modules/location/locationManager'; -import {CircleLayerStyleProps} from '../utils/MaplibreStyles'; +import {CircleLayerStyleProps} from '../utils/VietmapStyles'; import Annotation from './annotations/Annotation'; import CircleLayer from './CircleLayer'; diff --git a/javascript/components/VectorSource.tsx b/javascript/components/VectorSource.tsx index c0652c42..e73dafe9 100644 --- a/javascript/components/VectorSource.tsx +++ b/javascript/components/VectorSource.tsx @@ -1,4 +1,4 @@ -import {FilterExpression} from '../utils/MaplibreStyles'; +import {FilterExpression} from '../utils/VietmapStyles'; import {cloneReactChildrenWithProps, isFunction, isAndroid} from '../utils'; import {getFilter} from '../utils/filterUtils'; import {copyPropertiesAsDeprecated} from '../utils/deprecation'; @@ -17,7 +17,7 @@ import { } from 'react-native'; import {featureCollection} from '@turf/helpers'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLVectorSource'; @@ -94,7 +94,7 @@ class VectorSource extends NativeBridgeComponent( NATIVE_MODULE_NAME, ) { static defaultProps = { - id: MapLibreGL.StyleSource.DefaultSourceID, + id: VietmapGL.StyleSource.DefaultSourceID, }; constructor(props: VectorSourceProps) { diff --git a/javascript/components/annotations/Annotation.tsx b/javascript/components/annotations/Annotation.tsx index 7e481014..3d9c843d 100644 --- a/javascript/components/annotations/Annotation.tsx +++ b/javascript/components/annotations/Annotation.tsx @@ -2,7 +2,7 @@ import SymbolLayer from '../SymbolLayer'; import Animated from '../../utils/animated/Animated'; import AnimatedMapPoint from '../../utils/animated/AnimatedPoint'; import OnPressEvent from '../../types/OnPressEvent'; -import {SymbolLayerStyleProps} from '../../utils/MaplibreStyles'; +import {SymbolLayerStyleProps} from '../../utils/VietmapStyles'; import React, {ReactElement} from 'react'; import {Animated as RNAnimated, Easing} from 'react-native'; diff --git a/javascript/index.ts b/javascript/index.ts index 51b91fb8..232709c1 100644 --- a/javascript/index.ts +++ b/javascript/index.ts @@ -1,4 +1,4 @@ -export * from './Maplibre'; -import * as Maplibre from './Maplibre'; +export * from './Vietmap'; +import * as Vietmap from './Vietmap'; -export default Maplibre; +export default Vietmap; diff --git a/javascript/modules/location/locationManager.ts b/javascript/modules/location/locationManager.ts index 26bb840a..2a26988e 100644 --- a/javascript/modules/location/locationManager.ts +++ b/javascript/modules/location/locationManager.ts @@ -4,7 +4,7 @@ import { EmitterSubscription, } from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; const MapLibreGLLocationManager = NativeModules.MGLLocationModule; export const LocationModuleEventEmitter = new NativeEventEmitter( @@ -130,7 +130,7 @@ class LocationManager { MapLibreGLLocationManager.start(displacement); this.subscription = LocationModuleEventEmitter.addListener( - MapLibreGL.LocationCallbackName.Update, + VietmapGL.LocationCallbackName.Update, this.onUpdate, ); diff --git a/javascript/modules/offline/offlineManager.ts b/javascript/modules/offline/offlineManager.ts index cdb5e56f..0a9ea781 100644 --- a/javascript/modules/offline/offlineManager.ts +++ b/javascript/modules/offline/offlineManager.ts @@ -11,7 +11,7 @@ import { EventSubscription, } from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; const MapLibreGLOfflineManager = NativeModules.MGLOfflineModule; export const OfflineModuleEventEmitter = new NativeEventEmitter( MapLibreGLOfflineManager, @@ -82,7 +82,7 @@ class OfflineManager { * const progressListener = (offlineRegion, status) => console.log(offlineRegion, status); * const errorListener = (offlineRegion, err) => console.log(offlineRegion, err); * - * await MapLibreGL.offlineManager.createPack({ + * await VietmapGL.offlineManager.createPack({ * name: 'offlinePack', * styleURL: 'mapbox://...', * minZoom: 14, @@ -122,7 +122,7 @@ class OfflineManager { * This is more efficient than deleting the offline pack and downloading it again. If the data stored locally matches that on the server, new data will not be downloaded. * * @example - * await MapLibreGL.offlineManager.invalidatePack('packName') + * await VietmapGL.offlineManager.invalidatePack('packName') * * @param {String} name Name of the offline pack. * @return {void} @@ -144,7 +144,7 @@ class OfflineManager { * Unregisters the given offline pack and allows resources that are no longer required by any remaining packs to be potentially freed. * * @example - * await MapLibreGL.offlineManager.deletePack('packName') + * await VietmapGL.offlineManager.deletePack('packName') * * @param {String} name Name of the offline pack. * @return {void} @@ -170,7 +170,7 @@ class OfflineManager { * It does not erase resources from the ambient cache or delete the database, which can be computationally expensive operations that may carry unintended side effects. * * @example - * await MapLibreGL.offlineManager.invalidateAmbientCache(); + * await VietmapGL.offlineManager.invalidateAmbientCache(); * * @return {void} */ @@ -184,7 +184,7 @@ class OfflineManager { * This method clears the cache and decreases the amount of space that map resources take up on the device. * * @example - * await MapLibreGL.offlineManager.clearAmbientCache(); + * await VietmapGL.offlineManager.clearAmbientCache(); * * @return {void} */ @@ -198,7 +198,7 @@ class OfflineManager { * This method may be computationally expensive because it will erase resources from the ambient cache if its size is decreased. * * @example - * await MapLibreGL.offlineManager.setMaximumAmbientCacheSize(5000000); + * await VietmapGL.offlineManager.setMaximumAmbientCacheSize(5000000); * * @param {Number} size Size of ambient cache. * @return {void} @@ -212,7 +212,7 @@ class OfflineManager { * Deletes the existing database, which includes both the ambient cache and offline packs, then reinitializes it. * * @example - * await MapLibreGL.offlineManager.resetDatabase(); + * await VietmapGL.offlineManager.resetDatabase(); * * @return {void} */ @@ -225,7 +225,7 @@ class OfflineManager { * Retrieves all the current offline packs that are stored in the database. * * @example - * const offlinePacks = await MapLibreGL.offlineManager.getPacks(); + * const offlinePacks = await VietmapGL.offlineManager.getPacks(); * * @return {Array} */ @@ -240,7 +240,7 @@ class OfflineManager { * Retrieves an offline pack that is stored in the database by name. * * @example - * const offlinePack = await MapLibreGL.offlineManager.getPack(); + * const offlinePack = await VietmapGL.offlineManager.getPack(); * * @param {String} name Name of the offline pack. * @return {OfflinePack} @@ -254,7 +254,7 @@ class OfflineManager { * Sideloads offline db * * @example - * await MapLibreGL.offlineManager.mergeOfflineRegions(path); + * await VietmapGL.offlineManager.mergeOfflineRegions(path); * * @param {String} path Path to offline tile db on file system. * @return {void} @@ -269,7 +269,7 @@ class OfflineManager { * Consult the Terms of Service for your map tile host before changing this value. * * @example - * MapLibreGL.offlineManager.setTileCountLimit(1000); + * VietmapGL.offlineManager.setTileCountLimit(1000); * * @param {Number} limit Map tile limit count. * @return {void} @@ -283,7 +283,7 @@ class OfflineManager { * The default is 500ms. * * @example - * MapLibreGL.offlineManager.setProgressEventThrottle(500); + * VietmapGL.offlineManager.setProgressEventThrottle(500); * * @param {Number} throttleValue event throttle value in ms. * @return {void} @@ -299,7 +299,7 @@ class OfflineManager { * @example * const progressListener = (offlinePack, status) => console.log(offlinePack, status) * const errorListener = (offlinePack, err) => console.log(offlinePack, err) - * MapLibreGL.offlineManager.subscribe('packName', progressListener, errorListener) + * VietmapGL.offlineManager.subscribe('packName', progressListener, errorListener) * * @param {String} packName Name of the offline pack. * @param {Callback} progressListener Callback that listens for status events while downloading the offline resource. @@ -315,7 +315,7 @@ class OfflineManager { if (isFunction(progressListener)) { if (totalProgressListeners === 0) { this.subscriptionProgress = OfflineModuleEventEmitter.addListener( - MapLibreGL.OfflineCallbackName.Progress, + VietmapGL.OfflineCallbackName.Progress, this._onProgress, ); } @@ -326,7 +326,7 @@ class OfflineManager { if (isFunction(errorListener)) { if (totalErrorListeners === 0) { this.subscriptionError = OfflineModuleEventEmitter.addListener( - MapLibreGL.OfflineCallbackName.Error, + VietmapGL.OfflineCallbackName.Error, this._onError, ); } @@ -350,7 +350,7 @@ class OfflineManager { * It's a good idea to call this on componentWillUnmount. * * @example - * MapLibreGL.offlineManager.unsubscribe('packName') + * VietmapGL.offlineManager.unsubscribe('packName') * * @param {String} packName Name of the offline pack. * @return {void} @@ -403,7 +403,7 @@ class OfflineManager { this._progressListeners[name](pack, e.payload); // cleanup listeners now that they are no longer needed - if (state === MapLibreGL.OfflinePackDownloadState.Complete) { + if (state === VietmapGL.OfflinePackDownloadState.Complete) { this.unsubscribe(name); } } diff --git a/javascript/modules/snapshot/SnapshotOptions.ts b/javascript/modules/snapshot/SnapshotOptions.ts index 7816c292..d37e7026 100644 --- a/javascript/modules/snapshot/SnapshotOptions.ts +++ b/javascript/modules/snapshot/SnapshotOptions.ts @@ -3,7 +3,7 @@ import {makePoint, makeFeatureCollection} from '../../utils/geoUtils'; import {NativeModules} from 'react-native'; -const MapLibreGL = NativeModules.MGLModule; +const VietmapGL = NativeModules.MGLModule; export interface SnapshotInputOptions { centerCoordinate?: GeoJSON.Position; @@ -50,7 +50,7 @@ export class SnapshotOptions { ); } - this.styleURL = options.styleURL || MapLibreGL.StyleURL.Default; + this.styleURL = options.styleURL || VietmapGL.StyleURL.Default; this.heading = options.heading || 0.0; this.pitch = options.pitch || 0.0; this.zoomLevel = options.zoomLevel || 16.0; diff --git a/javascript/modules/snapshot/snapshotManager.ts b/javascript/modules/snapshot/snapshotManager.ts index 2bf10509..df178129 100644 --- a/javascript/modules/snapshot/snapshotManager.ts +++ b/javascript/modules/snapshot/snapshotManager.ts @@ -16,35 +16,35 @@ class SnapshotManager { * @example * * // creates a temp file png of base map - * const uri = await MapLibreGL.snapshotManager.takeSnap({ + * const uri = await VietmapGL.snapshotManager.takeSnap({ * centerCoordinate: [-74.126410, 40.797968], * width: width, * height: height, * zoomLevel: 12, * pitch: 30, * heading: 20, - * styleURL: MapLibreGL.StyleURL.Default, + * styleURL: VietmapGL.StyleURL.Default, * writeToDisk: true, // Create a temporary file * }); * * // creates base64 png of base map without logo - * const uri = await MapLibreGL.snapshotManager.takeSnap({ + * const uri = await VietmapGL.snapshotManager.takeSnap({ * centerCoordinate: [-74.126410, 40.797968], * width: width, * height: height, * zoomLevel: 12, * pitch: 30, * heading: 20, - * styleURL: MapLibreGL.StyleURL.Default, + * styleURL: VietmapGL.StyleURL.Default, * withLogo: false, // Disable Mapbox logo (Android only) * }); * * // creates snapshot with bounds - * const uri = await MapLibreGL.snapshotManager.takeSnap({ + * const uri = await VietmapGL.snapshotManager.takeSnap({ * bounds: [[-74.126410, 40.797968], [-74.143727, 40.772177]], * width: width, * height: height, - * styleURL: MapLibreGL.StyleURL.Default, + * styleURL: VietmapGL.StyleURL.Default, * }); * * @param {SnapshotOptions} options Snapshot options for create a static image of the base map diff --git a/javascript/utils/StyleValue.ts b/javascript/utils/StyleValue.ts index 1b6f8cba..169a3bdd 100644 --- a/javascript/utils/StyleValue.ts +++ b/javascript/utils/StyleValue.ts @@ -2,7 +2,7 @@ import BridgeValue, { type RawValueType, type StyleValueJSON, } from './BridgeValue'; -import {AllLayerStyleProps} from './MaplibreStyles'; +import {AllLayerStyleProps} from './VietmapStyles'; import {getStyleType} from './styleMap'; import {Image, processColor} from 'react-native'; diff --git a/javascript/utils/MaplibreStyles.d.ts b/javascript/utils/VietmapStyles.d.ts similarity index 100% rename from javascript/utils/MaplibreStyles.d.ts rename to javascript/utils/VietmapStyles.d.ts diff --git a/javascript/utils/filterUtils.ts b/javascript/utils/filterUtils.ts index 50748e40..70b9e316 100644 --- a/javascript/utils/filterUtils.ts +++ b/javascript/utils/filterUtils.ts @@ -1,4 +1,4 @@ -import {FilterExpression} from './MaplibreStyles'; +import {FilterExpression} from './VietmapStyles'; export function getFilter(filter: FilterExpression | undefined): string[] { if (!Array.isArray(filter) || filter.length === 0) { diff --git a/plugin/src/__tests__/withMapLibre-test.ts b/plugin/src/__tests__/withVietmap-test.ts similarity index 96% rename from plugin/src/__tests__/withMapLibre-test.ts rename to plugin/src/__tests__/withVietmap-test.ts index 66f6b2ed..7359d3e2 100644 --- a/plugin/src/__tests__/withMapLibre-test.ts +++ b/plugin/src/__tests__/withVietmap-test.ts @@ -1,4 +1,4 @@ -import {applyCocoaPodsModifications} from '../withMapLibre'; +import {applyCocoaPodsModifications} from '../withVietmap'; import * as fixtures from './fixtures/cocoapodFiles'; diff --git a/plugin/src/withMapLibre.ts b/plugin/src/withVietmap.ts similarity index 100% rename from plugin/src/withMapLibre.ts rename to plugin/src/withVietmap.ts diff --git a/scripts/autogenerate.js b/scripts/autogenerate.js index 3d3ea7b4..68f5f20f 100644 --- a/scripts/autogenerate.js +++ b/scripts/autogenerate.js @@ -19,7 +19,7 @@ function readIosVersion() { const podspecPath = path.join( __dirname, '..', - 'maplibre-react-native.podspec', + 'vietmap-react-native.podspec', ); const lines = fs.readFileSync(podspecPath, 'utf8').split('\n'); const maplibreLineRegex = /^\s+version:\s*"(\d+\.\d+\.\d+)"$/;