@maplibre/maplibre-react-native 9.1.0 → 10.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -2
- package/.husky/pre-commit +5 -0
- package/.yarn/plugins/@yarnpkg/plugin-typescript.cjs +9 -0
- package/.yarn/sdks/eslint/bin/eslint.js +20 -0
- package/.yarn/sdks/eslint/lib/api.js +20 -0
- package/.yarn/sdks/eslint/package.json +6 -0
- package/.yarn/sdks/integrations.yml +5 -0
- package/.yarn/sdks/prettier/index.js +20 -0
- package/.yarn/sdks/prettier/package.json +6 -0
- package/.yarn/sdks/typescript/bin/tsc +20 -0
- package/.yarn/sdks/typescript/bin/tsserver +20 -0
- package/.yarn/sdks/typescript/lib/tsc.js +20 -0
- package/.yarn/sdks/typescript/lib/tsserver.js +225 -0
- package/.yarn/sdks/typescript/lib/tsserverlibrary.js +225 -0
- package/.yarn/sdks/typescript/lib/typescript.js +20 -0
- package/.yarn/sdks/typescript/package.json +6 -0
- package/CHANGELOG.md +18 -0
- package/android/rctmgl/build.gradle +7 -7
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/location/LocationManager.java +2 -2
- package/android/rctmgl/src/main/java/com/mapbox/rctmgl/modules/RCTMGLOfflineModule.java +21 -26
- package/docs/Annotation.md +8 -9
- package/docs/BackgroundLayer.md +2 -10
- package/docs/Callout.md +5 -5
- package/docs/Camera.md +18 -47
- package/docs/CircleLayer.md +2 -10
- package/docs/FillExtrusionLayer.md +2 -10
- package/docs/FillLayer.md +2 -10
- package/docs/HeatmapLayer.md +2 -10
- package/docs/ImageSource.md +3 -2
- package/docs/Images.md +5 -3
- package/docs/Light.md +1 -1
- package/docs/LineLayer.md +2 -10
- package/docs/MapView.md +53 -37
- package/docs/MarkerView.md +4 -2
- package/docs/NativeUserLocation.md +2 -2
- package/docs/PointAnnotation.md +5 -8
- package/docs/RasterLayer.md +2 -10
- package/docs/RasterSource.md +3 -2
- package/docs/ShapeSource.md +12 -7
- package/docs/Style.md +1 -1
- package/docs/SymbolLayer.md +3 -10
- package/docs/UserLocation.md +8 -10
- package/docs/VectorSource.md +6 -5
- package/docs/coordinates.md +6 -0
- package/docs/docs.json +518 -1272
- package/docs/location.md +6 -0
- package/docs/snapshotManager.md +3 -3
- package/javascript/@types/assets.d.ts +4 -0
- package/javascript/MGLModule.ts +37 -0
- package/javascript/Maplibre.ts +65 -0
- package/javascript/components/AbstractLayer.tsx +107 -0
- package/javascript/components/AbstractSource.tsx +27 -0
- package/javascript/components/BackgroundLayer.tsx +43 -0
- package/javascript/components/{Callout.js → Callout.tsx} +67 -65
- package/javascript/components/{Camera.js → Camera.tsx} +266 -251
- package/javascript/components/CircleLayer.tsx +46 -0
- package/javascript/components/FillExtrusionLayer.tsx +47 -0
- package/javascript/components/FillLayer.tsx +41 -0
- package/javascript/components/{HeadingIndicator.js → HeadingIndicator.tsx} +8 -8
- package/javascript/components/HeatmapLayer.tsx +44 -0
- package/javascript/components/ImageSource.tsx +78 -0
- package/javascript/components/Images.tsx +134 -0
- package/javascript/components/Light.tsx +67 -0
- package/javascript/components/LineLayer.tsx +42 -0
- package/javascript/components/{MapView.js → MapView.tsx} +365 -354
- package/javascript/components/MarkerView.tsx +104 -0
- package/javascript/components/{NativeBridgeComponent.js → NativeBridgeComponent.tsx} +44 -13
- package/javascript/components/NativeUserLocation.tsx +33 -0
- package/javascript/components/PointAnnotation.tsx +221 -0
- package/javascript/components/RasterLayer.tsx +41 -0
- package/javascript/components/RasterSource.tsx +117 -0
- package/javascript/components/ShapeSource.tsx +383 -0
- package/javascript/components/{Style.js → Style.tsx} +129 -38
- package/javascript/components/SymbolLayer.tsx +72 -0
- package/javascript/components/{UserLocation.js → UserLocation.tsx} +111 -110
- package/javascript/components/VectorSource.tsx +207 -0
- package/javascript/components/annotations/Annotation.tsx +134 -0
- package/javascript/index.ts +4 -0
- package/javascript/modules/location/{locationManager.js → locationManager.ts} +71 -10
- package/javascript/modules/offline/{OfflineCreatePackOptions.js → OfflineCreatePackOptions.ts} +20 -4
- package/javascript/modules/offline/{OfflinePack.js → OfflinePack.ts} +23 -7
- package/javascript/modules/offline/{offlineManager.js → offlineManager.ts} +81 -24
- package/javascript/modules/snapshot/{SnapshotOptions.js → SnapshotOptions.ts} +43 -6
- package/javascript/modules/snapshot/{snapshotManager.js → snapshotManager.ts} +5 -5
- package/javascript/requestAndroidLocationPermissions.ts +29 -0
- package/javascript/types/BaseProps.ts +5 -0
- package/javascript/types/OnPressEvent.ts +13 -0
- package/javascript/types/index.ts +7 -0
- package/javascript/utils/BridgeValue.ts +90 -0
- package/javascript/utils/{Logger.js → Logger.ts} +37 -18
- package/javascript/utils/MaplibreStyles.d.ts +1486 -0
- package/javascript/utils/StyleValue.ts +49 -0
- package/javascript/utils/animated/AbstractAnimatedCoordinates.ts +134 -0
- package/javascript/utils/animated/AnimatedCoordinatesArray.ts +112 -0
- package/javascript/utils/animated/{AnimatedExtractCoordinateFromArray.js → AnimatedExtractCoordinateFromArray.ts} +5 -5
- package/javascript/utils/animated/{AnimatedPoint.js → AnimatedPoint.ts} +20 -12
- package/javascript/utils/animated/{AnimatedRouteCoordinatesArray.js → AnimatedRouteCoordinatesArray.ts} +39 -14
- package/javascript/utils/animated/{AnimatedShape.js → AnimatedShape.ts} +31 -10
- package/javascript/utils/{deprecation.js → deprecation.ts} +9 -6
- package/javascript/utils/filterUtils.ts +9 -0
- package/javascript/utils/geoUtils.ts +79 -0
- package/javascript/utils/{index.js → index.ts} +44 -24
- package/javascript/utils/styleMap.ts +264 -0
- package/package.json +35 -27
- package/plugin/build/withMapLibre.js +18 -3
- package/scripts/autogenHelpers/globals.js +1 -1
- package/scripts/autogenerate.js +14 -6
- package/scripts/download-style-spec.sh +1 -1
- package/scripts/templates/MaplibreStyles.ts.ejs +99 -0
- package/scripts/templates/index.d.ts.ejs +71 -42
- package/scripts/templates/{styleMap.js.ejs → styleMap.ts.ejs} +3 -33
- package/setup-jest.js +1 -10
- package/tsconfig.json +20 -61
- package/index.d.ts +0 -955
- package/javascript/components/AbstractLayer.js +0 -75
- package/javascript/components/AbstractSource.js +0 -15
- package/javascript/components/BackgroundLayer.js +0 -97
- package/javascript/components/CircleLayer.js +0 -101
- package/javascript/components/FillExtrusionLayer.js +0 -98
- package/javascript/components/FillLayer.js +0 -94
- package/javascript/components/HeatmapLayer.js +0 -99
- package/javascript/components/ImageSource.js +0 -82
- package/javascript/components/Images.js +0 -119
- package/javascript/components/Light.js +0 -47
- package/javascript/components/LineLayer.js +0 -94
- package/javascript/components/MarkerView.js +0 -87
- package/javascript/components/NativeUserLocation.js +0 -41
- package/javascript/components/PointAnnotation.js +0 -216
- package/javascript/components/RasterLayer.js +0 -95
- package/javascript/components/RasterSource.js +0 -124
- package/javascript/components/ShapeSource.js +0 -372
- package/javascript/components/SymbolLayer.js +0 -120
- package/javascript/components/VectorSource.js +0 -200
- package/javascript/components/annotations/Annotation.js +0 -122
- package/javascript/index.js +0 -149
- package/javascript/utils/BridgeValue.js +0 -81
- package/javascript/utils/animated/AnimatedCoordinatesArray.js +0 -191
- package/javascript/utils/filterUtils.js +0 -7
- package/javascript/utils/geoUtils.js +0 -73
- package/javascript/utils/styleMap.js +0 -1932
- /package/javascript/utils/animated/{Animated.js → Animated.ts} +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const {existsSync} = require(`fs`);
|
|
4
|
+
const {createRequire} = require(`module`);
|
|
5
|
+
const {resolve} = require(`path`);
|
|
6
|
+
|
|
7
|
+
const relPnpApiPath = "../../../../.pnp.cjs";
|
|
8
|
+
|
|
9
|
+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
|
10
|
+
const absRequire = createRequire(absPnpApiPath);
|
|
11
|
+
|
|
12
|
+
const moduleWrapper = tsserver => {
|
|
13
|
+
if (!process.versions.pnp) {
|
|
14
|
+
return tsserver;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const {isAbsolute} = require(`path`);
|
|
18
|
+
const pnpApi = require(`pnpapi`);
|
|
19
|
+
|
|
20
|
+
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
|
|
21
|
+
const isPortal = str => str.startsWith("portal:/");
|
|
22
|
+
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
|
|
23
|
+
|
|
24
|
+
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
|
|
25
|
+
return `${locator.name}@${locator.reference}`;
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
|
|
29
|
+
// doesn't understand. This layer makes sure to remove the protocol
|
|
30
|
+
// before forwarding it to TS, and to add it back on all returned paths.
|
|
31
|
+
|
|
32
|
+
function toEditorPath(str) {
|
|
33
|
+
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
|
|
34
|
+
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
|
|
35
|
+
// We also take the opportunity to turn virtual paths into physical ones;
|
|
36
|
+
// this makes it much easier to work with workspaces that list peer
|
|
37
|
+
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
|
|
38
|
+
// file instances instead of the real ones.
|
|
39
|
+
//
|
|
40
|
+
// We only do this to modules owned by the the dependency tree roots.
|
|
41
|
+
// This avoids breaking the resolution when jumping inside a vendor
|
|
42
|
+
// with peer dep (otherwise jumping into react-dom would show resolution
|
|
43
|
+
// errors on react).
|
|
44
|
+
//
|
|
45
|
+
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
|
|
46
|
+
if (resolved) {
|
|
47
|
+
const locator = pnpApi.findPackageLocator(resolved);
|
|
48
|
+
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
|
|
49
|
+
str = resolved;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
str = normalize(str);
|
|
54
|
+
|
|
55
|
+
if (str.match(/\.zip\//)) {
|
|
56
|
+
switch (hostInfo) {
|
|
57
|
+
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
|
|
58
|
+
// VSCode only adds it automatically for supported schemes,
|
|
59
|
+
// so we have to do it manually for the `zip` scheme.
|
|
60
|
+
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
|
|
61
|
+
//
|
|
62
|
+
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
|
63
|
+
//
|
|
64
|
+
// 2021-10-08: VSCode changed the format in 1.61.
|
|
65
|
+
// Before | ^zip:/c:/foo/bar.zip/package.json
|
|
66
|
+
// After | ^/zip//c:/foo/bar.zip/package.json
|
|
67
|
+
//
|
|
68
|
+
// 2022-04-06: VSCode changed the format in 1.66.
|
|
69
|
+
// Before | ^/zip//c:/foo/bar.zip/package.json
|
|
70
|
+
// After | ^/zip/c:/foo/bar.zip/package.json
|
|
71
|
+
//
|
|
72
|
+
// 2022-05-06: VSCode changed the format in 1.68
|
|
73
|
+
// Before | ^/zip/c:/foo/bar.zip/package.json
|
|
74
|
+
// After | ^/zip//c:/foo/bar.zip/package.json
|
|
75
|
+
//
|
|
76
|
+
case `vscode <1.61`: {
|
|
77
|
+
str = `^zip:${str}`;
|
|
78
|
+
} break;
|
|
79
|
+
|
|
80
|
+
case `vscode <1.66`: {
|
|
81
|
+
str = `^/zip/${str}`;
|
|
82
|
+
} break;
|
|
83
|
+
|
|
84
|
+
case `vscode <1.68`: {
|
|
85
|
+
str = `^/zip${str}`;
|
|
86
|
+
} break;
|
|
87
|
+
|
|
88
|
+
case `vscode`: {
|
|
89
|
+
str = `^/zip/${str}`;
|
|
90
|
+
} break;
|
|
91
|
+
|
|
92
|
+
// To make "go to definition" work,
|
|
93
|
+
// We have to resolve the actual file system path from virtual path
|
|
94
|
+
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
|
95
|
+
case `coc-nvim`: {
|
|
96
|
+
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
|
97
|
+
str = resolve(`zipfile:${str}`);
|
|
98
|
+
} break;
|
|
99
|
+
|
|
100
|
+
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
|
|
101
|
+
// We have to resolve the actual file system path from virtual path,
|
|
102
|
+
// everything else is up to neovim
|
|
103
|
+
case `neovim`: {
|
|
104
|
+
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
|
|
105
|
+
str = `zipfile://${str}`;
|
|
106
|
+
} break;
|
|
107
|
+
|
|
108
|
+
default: {
|
|
109
|
+
str = `zip:${str}`;
|
|
110
|
+
} break;
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return str;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function fromEditorPath(str) {
|
|
121
|
+
switch (hostInfo) {
|
|
122
|
+
case `coc-nvim`: {
|
|
123
|
+
str = str.replace(/\.zip::/, `.zip/`);
|
|
124
|
+
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
|
|
125
|
+
// So in order to convert it back, we use .* to match all the thing
|
|
126
|
+
// before `zipfile:`
|
|
127
|
+
return process.platform === `win32`
|
|
128
|
+
? str.replace(/^.*zipfile:\//, ``)
|
|
129
|
+
: str.replace(/^.*zipfile:/, ``);
|
|
130
|
+
} break;
|
|
131
|
+
|
|
132
|
+
case `neovim`: {
|
|
133
|
+
str = str.replace(/\.zip::/, `.zip/`);
|
|
134
|
+
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
|
|
135
|
+
return str.replace(/^zipfile:\/\//, ``);
|
|
136
|
+
} break;
|
|
137
|
+
|
|
138
|
+
case `vscode`:
|
|
139
|
+
default: {
|
|
140
|
+
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
|
|
141
|
+
} break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Force enable 'allowLocalPluginLoads'
|
|
146
|
+
// TypeScript tries to resolve plugins using a path relative to itself
|
|
147
|
+
// which doesn't work when using the global cache
|
|
148
|
+
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
|
|
149
|
+
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
|
|
150
|
+
// TypeScript already does local loads and if this code is running the user trusts the workspace
|
|
151
|
+
// https://github.com/microsoft/vscode/issues/45856
|
|
152
|
+
const ConfiguredProject = tsserver.server.ConfiguredProject;
|
|
153
|
+
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
|
|
154
|
+
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
|
|
155
|
+
this.projectService.allowLocalPluginLoads = true;
|
|
156
|
+
return originalEnablePluginsWithOptions.apply(this, arguments);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// And here is the point where we hijack the VSCode <-> TS communications
|
|
160
|
+
// by adding ourselves in the middle. We locate everything that looks
|
|
161
|
+
// like an absolute path of ours and normalize it.
|
|
162
|
+
|
|
163
|
+
const Session = tsserver.server.Session;
|
|
164
|
+
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
|
|
165
|
+
let hostInfo = `unknown`;
|
|
166
|
+
|
|
167
|
+
Object.assign(Session.prototype, {
|
|
168
|
+
onMessage(/** @type {string | object} */ message) {
|
|
169
|
+
const isStringMessage = typeof message === 'string';
|
|
170
|
+
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
|
|
171
|
+
|
|
172
|
+
if (
|
|
173
|
+
parsedMessage != null &&
|
|
174
|
+
typeof parsedMessage === `object` &&
|
|
175
|
+
parsedMessage.arguments &&
|
|
176
|
+
typeof parsedMessage.arguments.hostInfo === `string`
|
|
177
|
+
) {
|
|
178
|
+
hostInfo = parsedMessage.arguments.hostInfo;
|
|
179
|
+
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
|
|
180
|
+
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
|
|
181
|
+
// The RegExp from https://semver.org/ but without the caret at the start
|
|
182
|
+
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
|
183
|
+
) ?? []).map(Number)
|
|
184
|
+
|
|
185
|
+
if (major === 1) {
|
|
186
|
+
if (minor < 61) {
|
|
187
|
+
hostInfo += ` <1.61`;
|
|
188
|
+
} else if (minor < 66) {
|
|
189
|
+
hostInfo += ` <1.66`;
|
|
190
|
+
} else if (minor < 68) {
|
|
191
|
+
hostInfo += ` <1.68`;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
|
|
198
|
+
return typeof value === 'string' ? fromEditorPath(value) : value;
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return originalOnMessage.call(
|
|
202
|
+
this,
|
|
203
|
+
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
|
|
204
|
+
);
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
send(/** @type {any} */ msg) {
|
|
208
|
+
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
|
|
209
|
+
return typeof value === `string` ? toEditorPath(value) : value;
|
|
210
|
+
})));
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
return tsserver;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
if (existsSync(absPnpApiPath)) {
|
|
218
|
+
if (!process.versions.pnp) {
|
|
219
|
+
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
|
|
220
|
+
require(absPnpApiPath).setup();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Defer to the real typescript/lib/tsserverlibrary.js your application uses
|
|
225
|
+
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const {existsSync} = require(`fs`);
|
|
4
|
+
const {createRequire} = require(`module`);
|
|
5
|
+
const {resolve} = require(`path`);
|
|
6
|
+
|
|
7
|
+
const relPnpApiPath = "../../../../.pnp.cjs";
|
|
8
|
+
|
|
9
|
+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
|
|
10
|
+
const absRequire = createRequire(absPnpApiPath);
|
|
11
|
+
|
|
12
|
+
if (existsSync(absPnpApiPath)) {
|
|
13
|
+
if (!process.versions.pnp) {
|
|
14
|
+
// Setup the environment to be able to require typescript/lib/typescript.js
|
|
15
|
+
require(absPnpApiPath).setup();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Defer to the real typescript/lib/typescript.js your application uses
|
|
20
|
+
module.exports = absRequire(`typescript/lib/typescript.js`);
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ Please add unreleased changes in the following style:
|
|
|
5
5
|
PR Title ([#123](link to my pr))
|
|
6
6
|
```
|
|
7
7
|
|
|
8
|
+
## 10.0.0-alpha.2
|
|
9
|
+
|
|
10
|
+
Fix: Duplicated Signature issue with Xcode 15 ([#238](https://github.com/maplibre/maplibre-react-native/pull/238))
|
|
11
|
+
Update download-style-spec.sh ([#163](https://github.com/maplibre/maplibre-react-native/pull/163))
|
|
12
|
+
Update react-maplibre ([#34](https://github.com/maplibre/maplibre-react-native/issues/34))
|
|
13
|
+
chore: update support libraries ([#121](https://github.com/maplibre/maplibre-react-native/pull/121)).
|
|
14
|
+
|
|
15
|
+
## 10.0.0-alpha.1
|
|
16
|
+
|
|
17
|
+
fix: plugin for debug simulator ([#164](https://github.com/maplibre/maplibre-react-native/pull/164)
|
|
18
|
+
|
|
19
|
+
## 10.0-alpha.0
|
|
20
|
+
|
|
21
|
+
chore: update detox ([#207](https://github.com/maplibre/maplibre-react-native/pull/207))
|
|
22
|
+
chore: update expo-config and expo-scripts ([#47](https://github.com/maplibre/maplibre-react-native/pull/104) and [#69](https://github.com/maplibre/maplibre-react-native/pull/69))
|
|
23
|
+
chore: update prettier and eslint-plugin-prettier ([#111](https://github.com/maplibre/maplibre-react-native/pull/111))
|
|
24
|
+
feat: **breaking** migrate repo to typescript ([#55](https://github.com/maplibre/maplibre-react-native/pull/55))
|
|
25
|
+
|
|
8
26
|
## 9.1.0
|
|
9
27
|
|
|
10
28
|
Update react to 18.2.0 and react-native to 0.72.1. ([#49](https://github.com/maplibre/maplibre-react-native/pull/49))
|
|
@@ -33,21 +33,21 @@ dependencies {
|
|
|
33
33
|
implementation("com.facebook.react:react-android")
|
|
34
34
|
|
|
35
35
|
// MapLibre SDK
|
|
36
|
-
implementation "org.maplibre.gl:android-sdk:
|
|
36
|
+
implementation "org.maplibre.gl:android-sdk:10.2.0"
|
|
37
37
|
implementation "org.maplibre.gl:android-sdk-turf:5.9.0"
|
|
38
38
|
|
|
39
39
|
// Dependencies
|
|
40
|
-
implementation "
|
|
41
|
-
implementation "
|
|
42
|
-
implementation "
|
|
40
|
+
implementation "androidx.vectordrawable:vectordrawable:1.1.0"
|
|
41
|
+
implementation "androidx.annotation:annotation:1.7.0"
|
|
42
|
+
implementation "androidx.appcompat:appcompat:1.6.1"
|
|
43
43
|
implementation "com.squareup.okhttp3:okhttp:${safeExtGet('okhttpVersion', '4.9.0')}"
|
|
44
44
|
implementation "com.squareup.okhttp3:okhttp-urlconnection:${safeExtGet('okhttpVersion', '4.9.0')}"
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
// MapLibre plugins
|
|
48
|
-
implementation ("org.maplibre.gl:android-plugin-localization-v9:
|
|
49
|
-
implementation ("org.maplibre.gl:android-plugin-annotation-v9:
|
|
50
|
-
implementation ("org.maplibre.gl:android-plugin-markerview-v9:
|
|
48
|
+
implementation ("org.maplibre.gl:android-plugin-localization-v9:2.0.1")
|
|
49
|
+
implementation ("org.maplibre.gl:android-plugin-annotation-v9:2.0.1")
|
|
50
|
+
implementation ("org.maplibre.gl:android-plugin-markerview-v9:2.0.1")
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
allprojects {
|
|
@@ -13,7 +13,7 @@ import com.mapbox.android.core.location.LocationEngineListener;
|
|
|
13
13
|
import com.mapbox.android.core.location.LocationEnginePriority;
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import com.mapbox.mapboxsdk.location.engine.
|
|
16
|
+
import com.mapbox.mapboxsdk.location.engine.LocationEngineDefault;
|
|
17
17
|
import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest;
|
|
18
18
|
import com.mapbox.mapboxsdk.location.engine.LocationEngineResult;
|
|
19
19
|
import com.mapbox.mapboxsdk.location.permissions.PermissionsManager;
|
|
@@ -63,7 +63,7 @@ public class LocationManager implements LocationEngineCallback<LocationEngineRes
|
|
|
63
63
|
|
|
64
64
|
}
|
|
65
65
|
private void buildEngineRequest() {
|
|
66
|
-
locationEngine =
|
|
66
|
+
locationEngine = LocationEngineDefault.INSTANCE.getDefaultLocationEngine(this.context.getApplicationContext());
|
|
67
67
|
locationEngineRequest = new LocationEngineRequest.Builder(DEFAULT_INTERVAL_MILLIS)
|
|
68
68
|
.setFastestInterval(DEFAULT_FASTEST_INTERVAL_MILLIS)
|
|
69
69
|
.setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY)
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
package com.mapbox.rctmgl.modules;
|
|
2
2
|
|
|
3
|
+
import android.content.Context;
|
|
3
4
|
import android.os.Handler;
|
|
4
5
|
import android.os.Looper;
|
|
5
6
|
import android.util.Log;
|
|
6
7
|
|
|
7
|
-
import com.facebook.react.bridge
|
|
8
|
-
import com.facebook.react.bridge.Promise;
|
|
9
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
12
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
13
|
-
import com.facebook.react.bridge.WritableArray;
|
|
14
|
-
import com.facebook.react.bridge.WritableMap;
|
|
15
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
8
|
+
import com.facebook.react.bridge.*;
|
|
16
9
|
import com.facebook.react.module.annotations.ReactModule;
|
|
17
10
|
import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
|
|
18
11
|
import com.mapbox.geojson.FeatureCollection;
|
|
@@ -58,12 +51,14 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
58
51
|
public static final Double DEFAULT_MIN_ZOOM_LEVEL = 10.0;
|
|
59
52
|
public static final Double DEFAULT_MAX_ZOOM_LEVEL = 20.0;
|
|
60
53
|
|
|
61
|
-
private
|
|
54
|
+
private final Context mContext;
|
|
55
|
+
private final ReactContext mReactContext;
|
|
62
56
|
private Double mProgressEventThrottle = 300.0;
|
|
63
57
|
|
|
64
58
|
public RCTMGLOfflineModule(ReactApplicationContext reactApplicationContext) {
|
|
65
59
|
super(reactApplicationContext);
|
|
66
60
|
mReactContext = reactApplicationContext;
|
|
61
|
+
mContext = reactApplicationContext.getApplicationContext();
|
|
67
62
|
}
|
|
68
63
|
|
|
69
64
|
@Override
|
|
@@ -84,7 +79,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
84
79
|
@ReactMethod
|
|
85
80
|
public void createPack(ReadableMap options, final Promise promise) {
|
|
86
81
|
final String name = ConvertUtils.getString("name", options, "");
|
|
87
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
82
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
88
83
|
LatLngBounds latLngBounds = getBoundsFromOptions(options);
|
|
89
84
|
|
|
90
85
|
OfflineRegionDefinition definition = makeDefinition(latLngBounds, options);
|
|
@@ -110,7 +105,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
110
105
|
public void getPacks(final Promise promise) {
|
|
111
106
|
activateFileSource();
|
|
112
107
|
|
|
113
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
108
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
114
109
|
|
|
115
110
|
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
|
|
116
111
|
@Override
|
|
@@ -134,7 +129,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
134
129
|
@ReactMethod
|
|
135
130
|
public void invalidateAmbientCache(final Promise promise) {
|
|
136
131
|
activateFileSource();
|
|
137
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
132
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
138
133
|
offlineManager.invalidateAmbientCache(new OfflineManager.FileSourceCallback() {
|
|
139
134
|
@Override
|
|
140
135
|
public void onSuccess() {
|
|
@@ -152,7 +147,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
152
147
|
public void clearAmbientCache(final Promise promise) {
|
|
153
148
|
activateFileSource();
|
|
154
149
|
|
|
155
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
150
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
156
151
|
|
|
157
152
|
offlineManager.clearAmbientCache(new OfflineManager.FileSourceCallback() {
|
|
158
153
|
@Override
|
|
@@ -171,7 +166,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
171
166
|
public void setMaximumAmbientCacheSize(int size, final Promise promise) {
|
|
172
167
|
activateFileSource();
|
|
173
168
|
|
|
174
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
169
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
175
170
|
|
|
176
171
|
offlineManager.setMaximumAmbientCacheSize(size, new OfflineManager.FileSourceCallback() {
|
|
177
172
|
@Override
|
|
@@ -190,7 +185,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
190
185
|
@ReactMethod
|
|
191
186
|
public void resetDatabase(final Promise promise) {
|
|
192
187
|
activateFileSource();
|
|
193
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
188
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
194
189
|
offlineManager.resetDatabase(new OfflineManager.FileSourceCallback() {
|
|
195
190
|
@Override
|
|
196
191
|
public void onSuccess() {
|
|
@@ -208,7 +203,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
208
203
|
public void getPackStatus(final String name, final Promise promise) {
|
|
209
204
|
activateFileSource();
|
|
210
205
|
|
|
211
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
206
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
212
207
|
|
|
213
208
|
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
|
|
214
209
|
@Override
|
|
@@ -245,7 +240,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
245
240
|
public void setPackObserver(final String name, final Promise promise) {
|
|
246
241
|
activateFileSource();
|
|
247
242
|
|
|
248
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
243
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
249
244
|
|
|
250
245
|
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
|
|
251
246
|
@Override
|
|
@@ -271,7 +266,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
271
266
|
public void invalidatePack(final String name, final Promise promise) {
|
|
272
267
|
activateFileSource();
|
|
273
268
|
|
|
274
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
269
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
275
270
|
|
|
276
271
|
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
|
|
277
272
|
@Override
|
|
@@ -308,7 +303,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
308
303
|
public void deletePack(final String name, final Promise promise) {
|
|
309
304
|
activateFileSource();
|
|
310
305
|
|
|
311
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
306
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
312
307
|
|
|
313
308
|
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
|
|
314
309
|
@Override
|
|
@@ -348,7 +343,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
348
343
|
public void pausePackDownload(final String name, final Promise promise) {
|
|
349
344
|
activateFileSource();
|
|
350
345
|
|
|
351
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
346
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
352
347
|
|
|
353
348
|
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
|
|
354
349
|
@Override
|
|
@@ -380,7 +375,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
380
375
|
public void resumePackDownload(final String name, final Promise promise) {
|
|
381
376
|
activateFileSource();
|
|
382
377
|
|
|
383
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
378
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
384
379
|
|
|
385
380
|
offlineManager.listOfflineRegions(new OfflineManager.ListOfflineRegionsCallback() {
|
|
386
381
|
@Override
|
|
@@ -407,7 +402,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
407
402
|
public void mergeOfflineRegions(final String path, final Promise promise) {
|
|
408
403
|
activateFileSource();
|
|
409
404
|
|
|
410
|
-
final OfflineManager offlineManager = OfflineManager.getInstance(
|
|
405
|
+
final OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
411
406
|
|
|
412
407
|
offlineManager.mergeOfflineRegions(path, new OfflineManager.MergeOfflineRegionsCallback() {
|
|
413
408
|
@Override
|
|
@@ -424,7 +419,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
424
419
|
|
|
425
420
|
@ReactMethod
|
|
426
421
|
public void setTileCountLimit(int tileCountLimit) {
|
|
427
|
-
OfflineManager offlineManager = OfflineManager.getInstance(
|
|
422
|
+
OfflineManager offlineManager = OfflineManager.Companion.getInstance(mContext);
|
|
428
423
|
offlineManager.setOfflineMapboxTileCountLimit(tileCountLimit);
|
|
429
424
|
}
|
|
430
425
|
|
|
@@ -439,7 +434,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
439
434
|
latLngBounds,
|
|
440
435
|
ConvertUtils.getDouble("minZoom", options, DEFAULT_MIN_ZOOM_LEVEL),
|
|
441
436
|
ConvertUtils.getDouble("maxZoom", options, DEFAULT_MAX_ZOOM_LEVEL),
|
|
442
|
-
|
|
437
|
+
mContext.getResources().getDisplayMetrics().density);
|
|
443
438
|
}
|
|
444
439
|
|
|
445
440
|
private byte[] getMetadataBytes(String metadata) {
|
|
@@ -591,7 +586,7 @@ public class RCTMGLOfflineModule extends ReactContextBaseJavaModule {
|
|
|
591
586
|
}
|
|
592
587
|
|
|
593
588
|
private void activateFileSource() {
|
|
594
|
-
FileSource fileSource = FileSource.getInstance(
|
|
589
|
+
FileSource fileSource = FileSource.getInstance(mContext);
|
|
595
590
|
fileSource.activate();
|
|
596
591
|
}
|
|
597
592
|
}
|
package/docs/Annotation.md
CHANGED
|
@@ -6,24 +6,23 @@
|
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| id | `string` | `none` | `true` | FIX ME NO DESCRIPTION |
|
|
9
|
-
| animated | `
|
|
9
|
+
| animated | `boolean` | `false` | `false` | FIX ME NO DESCRIPTION |
|
|
10
10
|
| animationDuration | `number` | `1000` | `false` | FIX ME NO DESCRIPTION |
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
| icon | `union` | `none` | `false` | FIX ME NO DESCRIPTION |
|
|
11
|
+
| coordinates | `Array` | `none` | `false` | FIX ME NO DESCRIPTION |
|
|
12
|
+
| children | `ReactElement \| ReactElement[]` | `none` | `false` | FIX ME NO DESCRIPTION |
|
|
13
|
+
| style | `object` | `none` | `false` | FIX ME NO DESCRIPTION |
|
|
14
|
+
| icon | `string \| number \| object` | `none` | `false` | FIX ME NO DESCRIPTION |
|
|
15
|
+
| animationEasingFunction | `FIX ME UNKNOWN TYPE` | `Easing.linear` | `false` | FIX ME NO DESCRIPTION |
|
|
17
16
|
|
|
18
17
|
### methods
|
|
19
|
-
#### onPress()
|
|
18
|
+
#### onPress(event)
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
##### arguments
|
|
24
23
|
| Name | Type | Required | Description |
|
|
25
24
|
| ---- | :--: | :------: | :----------: |
|
|
26
|
-
|
|
25
|
+
| `event` | `OnPressEvent` | `Yes` | undefined |
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
#### symbolStyle()
|
package/docs/BackgroundLayer.md
CHANGED
|
@@ -5,16 +5,8 @@
|
|
|
5
5
|
### props
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
|
-
|
|
|
9
|
-
| sourceID | `
|
|
10
|
-
| sourceLayerID | `string` | `none` | `false` | Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style. |
|
|
11
|
-
| aboveLayerID | `string` | `none` | `false` | Inserts a layer above aboveLayerID. |
|
|
12
|
-
| belowLayerID | `string` | `none` | `false` | Inserts a layer below belowLayerID |
|
|
13
|
-
| layerIndex | `number` | `none` | `false` | Inserts a layer at a specified index |
|
|
14
|
-
| filter | `array` | `none` | `false` | Filter only the features in the source layer that satisfy a condition that you define |
|
|
15
|
-
| minZoomLevel | `number` | `none` | `false` | The minimum zoom level at which the layer gets parsed and appears. |
|
|
16
|
-
| maxZoomLevel | `number` | `none` | `false` | The maximum zoom level at which the layer gets parsed and appears. |
|
|
17
|
-
| style | `union` | `none` | `false` | Customizable style attributes |
|
|
8
|
+
| style | `BackgroundLayerStyleProps` | `none` | `false` | Customizable style attributes |
|
|
9
|
+
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreGL.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |
|
|
18
10
|
|
|
19
11
|
|
|
20
12
|
### styles
|
package/docs/Callout.md
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
| Prop | Type | Default | Required | Description |
|
|
7
7
|
| ---- | :--: | :-----: | :------: | :----------: |
|
|
8
8
|
| title | `string` | `none` | `false` | String that get's displayed in the default callout. |
|
|
9
|
-
| style | `
|
|
10
|
-
| containerStyle | `
|
|
11
|
-
| contentStyle | `
|
|
12
|
-
| tipStyle | `
|
|
13
|
-
| textStyle | `
|
|
9
|
+
| style | `ViewStyle` | `none` | `false` | Style property for the Animated.View wrapper, apply animations to this |
|
|
10
|
+
| containerStyle | `ViewStyle` | `none` | `false` | Style property for the native RCTMGLCallout container, set at your own risk. |
|
|
11
|
+
| contentStyle | `ViewStyle` | `none` | `false` | Style property for the content bubble. |
|
|
12
|
+
| tipStyle | `ViewStyle` | `none` | `false` | Style property for the triangle tip under the content. |
|
|
13
|
+
| textStyle | `ViewStyle` | `none` | `false` | Style property for the title in the content bubble. |
|
|
14
14
|
|
|
15
15
|
|