react-native-maps 1.4.0 → 1.5.0-beta.1
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/README.md +63 -87
- package/android/build.gradle +3 -4
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/FileUtil.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/FusedLocationSource.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageReadable.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageReader.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ImageUtil.java +1 -2
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/LatLngBoundsUtils.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCallout.java → rnmaps/maps/MapCallout.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCalloutManager.java → rnmaps/maps/MapCalloutManager.java} +6 -6
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCircle.java → rnmaps/maps/MapCircle.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapCircleManager.java → rnmaps/maps/MapCircleManager.java} +11 -11
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapFeature.java → rnmaps/maps/MapFeature.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapGradientPolyline.java → rnmaps/maps/MapGradientPolyline.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapGradientPolylineManager.java → rnmaps/maps/MapGradientPolylineManager.java} +9 -9
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapHeatmap.java → rnmaps/maps/MapHeatmap.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapHeatmapManager.java → rnmaps/maps/MapHeatmapManager.java} +8 -8
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapLiteManager.java → rnmaps/maps/MapLiteManager.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapLocalTile.java → rnmaps/maps/MapLocalTile.java} +5 -5
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapLocalTileManager.java → rnmaps/maps/MapLocalTileManager.java} +9 -9
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapManager.java → rnmaps/maps/MapManager.java} +48 -48
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapMarker.java → rnmaps/maps/MapMarker.java} +12 -12
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapMarkerManager.java → rnmaps/maps/MapMarkerManager.java} +30 -30
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapModule.java → rnmaps/maps/MapModule.java} +10 -10
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapOverlay.java → rnmaps/maps/MapOverlay.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapOverlayManager.java → rnmaps/maps/MapOverlayManager.java} +11 -11
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolygon.java → rnmaps/maps/MapPolygon.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolygonManager.java → rnmaps/maps/MapPolygonManager.java} +13 -13
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolyline.java → rnmaps/maps/MapPolyline.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapPolylineManager.java → rnmaps/maps/MapPolylineManager.java} +13 -13
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapTileProvider.java → rnmaps/maps/MapTileProvider.java} +10 -10
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapTileWorker.java → rnmaps/maps/MapTileWorker.java} +3 -3
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapUrlTile.java → rnmaps/maps/MapUrlTile.java} +5 -5
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapUrlTileManager.java → rnmaps/maps/MapUrlTileManager.java} +17 -17
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapView.java → rnmaps/maps/MapView.java} +62 -63
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapWMSTile.java → rnmaps/maps/MapWMSTile.java} +6 -6
- package/android/src/main/java/com/{airbnb/android/react/maps/AirMapWMSTileManager.java → rnmaps/maps/MapWMSTileManager.java} +15 -15
- package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +46 -0
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/RegionChangeEvent.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/SizeReportingShadowNode.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ViewAttacherGroup.java +1 -1
- package/android/src/main/java/com/{airbnb/android/react → rnmaps}/maps/ViewChangesTracker.java +7 -7
- package/package.json +15 -13
- package/android/src/main/java/com/airbnb/android/react/maps/MapsPackage.java +0 -65
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
React Native Map components for iOS + Android
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
## Contributing
|
|
6
|
+
|
|
7
7
|
This project is being maintained by a small group of people, and any help with issues and pull requests are always appreciated. If you are able and willing to contribute, please read the [guidelines](./CONTRIBUTING.md).
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
@@ -41,6 +41,7 @@ See [Setup Instructions for the Included Example Project](docs/examples-setup.md
|
|
|
41
41
|
```js
|
|
42
42
|
import MapView from 'react-native-maps';
|
|
43
43
|
```
|
|
44
|
+
|
|
44
45
|
or
|
|
45
46
|
|
|
46
47
|
```js
|
|
@@ -54,15 +55,16 @@ declaratively controlling features on the map.
|
|
|
54
55
|
### Rendering a Map with an initial region
|
|
55
56
|
|
|
56
57
|
## MapView
|
|
58
|
+
|
|
57
59
|
```jsx
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
<MapView
|
|
61
|
+
initialRegion={{
|
|
62
|
+
latitude: 37.78825,
|
|
63
|
+
longitude: -122.4324,
|
|
64
|
+
latitudeDelta: 0.0922,
|
|
65
|
+
longitudeDelta: 0.0421,
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
66
68
|
```
|
|
67
69
|
|
|
68
70
|
### Using a MapView while controlling the region as state
|
|
@@ -96,12 +98,9 @@ render() {
|
|
|
96
98
|
### Rendering a list of markers on a map
|
|
97
99
|
|
|
98
100
|
```jsx
|
|
99
|
-
import {
|
|
101
|
+
import {Marker} from 'react-native-maps';
|
|
100
102
|
|
|
101
|
-
<MapView
|
|
102
|
-
region={this.state.region}
|
|
103
|
-
onRegionChange={this.onRegionChange}
|
|
104
|
-
>
|
|
103
|
+
<MapView region={this.state.region} onRegionChange={this.onRegionChange}>
|
|
105
104
|
{this.state.markers.map((marker, index) => (
|
|
106
105
|
<Marker
|
|
107
106
|
key={index}
|
|
@@ -110,16 +109,18 @@ import { Marker } from 'react-native-maps';
|
|
|
110
109
|
description={marker.description}
|
|
111
110
|
/>
|
|
112
111
|
))}
|
|
113
|
-
</MapView
|
|
112
|
+
</MapView>;
|
|
114
113
|
```
|
|
115
114
|
|
|
116
115
|
### Rendering a Marker with a custom image
|
|
116
|
+
|
|
117
117
|
1. You need to generate an `png` image with various resolution (lets call them `custom_pin`) - for more information go to [Android](https://developer.android.com/studio/write/resource-manager#import), [iOS](https://developer.apple.com/documentation/xcode/adding-images-to-your-xcode-project)
|
|
118
|
-
2. put all images in Android drawables and iOS assets dir
|
|
118
|
+
2. put all images in Android drawables and iOS assets dir
|
|
119
119
|
3. Now you can use the following code:
|
|
120
|
+
|
|
120
121
|
```jsx
|
|
121
122
|
<Marker
|
|
122
|
-
coordinate={{
|
|
123
|
+
coordinate={{latitude: latitude, longitude: longitude}}
|
|
123
124
|
image={{uri: 'custom_pin'}}
|
|
124
125
|
/>
|
|
125
126
|
```
|
|
@@ -127,10 +128,11 @@ import { Marker } from 'react-native-maps';
|
|
|
127
128
|
Note: You can also pass the image binary data like `image={require('custom_pin.png')}`, but this will not scale good with the different screen sizes.
|
|
128
129
|
|
|
129
130
|
### Rendering a Marker with a custom view
|
|
131
|
+
|
|
130
132
|
Note: This has performance implications, if you wish for a simpler solution go with a custom image (save your self the head ache)
|
|
131
133
|
|
|
132
134
|
```jsx
|
|
133
|
-
<Marker coordinate={{
|
|
135
|
+
<Marker coordinate={{latitude: latitude, longitude: longitude}}>
|
|
134
136
|
<MyCustomMarkerView {...marker} />
|
|
135
137
|
</Marker>
|
|
136
138
|
```
|
|
@@ -138,14 +140,14 @@ Note: This has performance implications, if you wish for a simpler solution go w
|
|
|
138
140
|
### Rendering a custom Marker with a custom Callout
|
|
139
141
|
|
|
140
142
|
```jsx
|
|
141
|
-
import {
|
|
143
|
+
import {Callout} from 'react-native-maps';
|
|
142
144
|
|
|
143
145
|
<Marker coordinate={marker.latlng}>
|
|
144
146
|
<MyCustomMarkerView {...marker} />
|
|
145
147
|
<Callout>
|
|
146
148
|
<MyCustomCalloutView {...marker} />
|
|
147
149
|
</Callout>
|
|
148
|
-
</Marker
|
|
150
|
+
</Marker>;
|
|
149
151
|
```
|
|
150
152
|
|
|
151
153
|
### Draggable Markers
|
|
@@ -164,12 +166,9 @@ import { Callout } from 'react-native-maps';
|
|
|
164
166
|
#### Tile Overlay using tile server
|
|
165
167
|
|
|
166
168
|
```jsx
|
|
167
|
-
import {
|
|
169
|
+
import {UrlTile} from 'react-native-maps';
|
|
168
170
|
|
|
169
|
-
<MapView
|
|
170
|
-
region={this.state.region}
|
|
171
|
-
onRegionChange={this.onRegionChange}
|
|
172
|
-
>
|
|
171
|
+
<MapView region={this.state.region} onRegionChange={this.onRegionChange}>
|
|
173
172
|
<UrlTile
|
|
174
173
|
/**
|
|
175
174
|
* The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
|
|
@@ -187,13 +186,15 @@ import { UrlTile } from 'react-native-maps';
|
|
|
187
186
|
*/
|
|
188
187
|
flipY={false}
|
|
189
188
|
/>
|
|
190
|
-
</MapView
|
|
189
|
+
</MapView>;
|
|
191
190
|
```
|
|
192
191
|
|
|
193
192
|
For Android: add the following line in your AndroidManifest.xml
|
|
193
|
+
|
|
194
194
|
```xml
|
|
195
195
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
196
196
|
```
|
|
197
|
+
|
|
197
198
|
For IOS: configure [App Transport Security](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33) in your app
|
|
198
199
|
|
|
199
200
|
#### Tile Overlay using local tiles
|
|
@@ -201,27 +202,25 @@ For IOS: configure [App Transport Security](https://developer.apple.com/library/
|
|
|
201
202
|
Tiles can be stored locally within device using xyz tiling scheme and displayed as tile overlay as well. This is usefull especially for offline map usage when tiles are available for selected map region within device storage.
|
|
202
203
|
|
|
203
204
|
```jsx
|
|
204
|
-
import {
|
|
205
|
+
import {LocalTile} from 'react-native-maps';
|
|
205
206
|
|
|
206
|
-
<MapView
|
|
207
|
-
region={this.state.region}
|
|
208
|
-
onRegionChange={this.onRegionChange}
|
|
209
|
-
>
|
|
207
|
+
<MapView region={this.state.region} onRegionChange={this.onRegionChange}>
|
|
210
208
|
<LocalTile
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
209
|
+
/**
|
|
210
|
+
* The path template of the locally stored tiles. The patterns {x} {y} {z} will be replaced at runtime
|
|
211
|
+
* For example, /storage/emulated/0/mytiles/{z}/{x}/{y}.png
|
|
212
|
+
*/
|
|
213
|
+
pathTemplate={this.state.pathTemplate}
|
|
214
|
+
/**
|
|
215
|
+
* The size of provided local tiles (usually 256 or 512).
|
|
216
|
+
*/
|
|
217
|
+
tileSize={256}
|
|
220
218
|
/>
|
|
221
|
-
</MapView
|
|
219
|
+
</MapView>;
|
|
222
220
|
```
|
|
223
221
|
|
|
224
222
|
For Android: LocalTile is still just overlay over original map tiles. It means that if device is online, underlying tiles will be still downloaded. If original tiles download/display is not desirable set mapType to 'none'. For example:
|
|
223
|
+
|
|
225
224
|
```
|
|
226
225
|
<MapView
|
|
227
226
|
mapType={Platform.OS == "android" ? "none" : "standard"}
|
|
@@ -265,6 +264,7 @@ render() {
|
|
|
265
264
|
);
|
|
266
265
|
}
|
|
267
266
|
```
|
|
267
|
+
|
|
268
268
|
For iOS, in addition to providing the `mapStyle` you will need to do the following
|
|
269
269
|
|
|
270
270
|
```jsx
|
|
@@ -291,36 +291,26 @@ This example displays some of them in a log as a demonstration.
|
|
|
291
291
|
|
|
292
292
|
 
|
|
293
293
|
|
|
294
|
-
|
|
295
|
-
|
|
296
294
|
### Tracking Region / Location
|
|
297
295
|
|
|
298
296
|
 
|
|
299
297
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
298
|
### Programmatically Changing Region
|
|
304
299
|
|
|
305
300
|
One can change the mapview's position using refs and component methods, or by passing in an updated
|
|
306
|
-
`region` prop.
|
|
301
|
+
`region` prop. The component methods will allow one to animate to a given position like the native
|
|
307
302
|
API could.
|
|
308
303
|
|
|
309
304
|
 
|
|
310
305
|
|
|
311
|
-
|
|
312
306
|
### Changing the style of the map
|
|
313
307
|
|
|
314
308
|

|
|
315
309
|
|
|
316
|
-
|
|
317
|
-
|
|
318
310
|
### Arbitrary React Views as Markers
|
|
319
311
|
|
|
320
312
|
 
|
|
321
313
|
|
|
322
|
-
|
|
323
|
-
|
|
324
314
|
### Using the MapView with the Animated API
|
|
325
315
|
|
|
326
316
|
The `<MapView />` component can be made to work with the Animated API, having the entire `region` prop
|
|
@@ -338,14 +328,10 @@ Markers' coordinates can also be animated, as shown in this example:
|
|
|
338
328
|
|
|
339
329
|
 
|
|
340
330
|
|
|
341
|
-
|
|
342
|
-
|
|
343
331
|
### Polygon Creator
|
|
344
332
|
|
|
345
333
|
 
|
|
346
334
|
|
|
347
|
-
|
|
348
|
-
|
|
349
335
|
### Other Overlays
|
|
350
336
|
|
|
351
337
|
So far, `<Circle />`, `<Polygon />`, and `<Polyline />` are available to pass in as children to the
|
|
@@ -353,16 +339,12 @@ So far, `<Circle />`, `<Polygon />`, and `<Polyline />` are available to pass in
|
|
|
353
339
|
|
|
354
340
|
 
|
|
355
341
|
|
|
356
|
-
|
|
357
|
-
|
|
358
342
|
### Gradient Polylines (iOS MapKit only)
|
|
359
343
|
|
|
360
344
|
Gradient polylines can be created using the `strokeColors` prop of the `<Polyline>` component.
|
|
361
345
|
|
|
362
346
|

|
|
363
347
|
|
|
364
|
-
|
|
365
|
-
|
|
366
348
|
### Default Markers
|
|
367
349
|
|
|
368
350
|
Default markers will be rendered unless a custom marker is specified. One can optionally adjust the
|
|
@@ -370,11 +352,9 @@ color of the default marker by using the `pinColor` prop.
|
|
|
370
352
|
|
|
371
353
|
 
|
|
372
354
|
|
|
373
|
-
|
|
374
|
-
|
|
375
355
|
### Custom Callouts
|
|
376
356
|
|
|
377
|
-
Callouts to markers can be completely arbitrary react views, similar to markers.
|
|
357
|
+
Callouts to markers can be completely arbitrary react views, similar to markers. As a result, they
|
|
378
358
|
can be interacted with like any other view.
|
|
379
359
|
|
|
380
360
|
Additionally, you can fall back to the standard behavior of just having a title/description through
|
|
@@ -388,16 +368,12 @@ See `Callouts.js` example.
|
|
|
388
368
|
|
|
389
369
|
 
|
|
390
370
|
|
|
391
|
-
|
|
392
|
-
|
|
393
371
|
### Image-based Markers
|
|
394
372
|
|
|
395
373
|
Markers can be customized by just using images, and specified using the `image` prop.
|
|
396
374
|
|
|
397
375
|

|
|
398
376
|
|
|
399
|
-
|
|
400
|
-
|
|
401
377
|
### Draggable Markers
|
|
402
378
|
|
|
403
379
|
Markers are draggable, and emit continuous drag events to update other UI during drags.
|
|
@@ -558,10 +534,10 @@ Pass an array of coordinates to focus a map region on said coordinates.
|
|
|
558
534
|
|
|
559
535
|
#### My map is blank
|
|
560
536
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
537
|
+
- Make sure that you have [properly installed](docs/installation.md) react-native-maps.
|
|
538
|
+
- Check in the logs if there is more informations about the issue.
|
|
539
|
+
- Try setting the style of the MapView to an absolute position with top, left, right and bottom values set.
|
|
540
|
+
- Make sure you have enabled Google Maps API in [Google developer console](https://console.developers.google.com/apis/library)
|
|
565
541
|
|
|
566
542
|
```javascript
|
|
567
543
|
const styles = StyleSheet.create({
|
|
@@ -580,14 +556,14 @@ const styles = StyleSheet.create({
|
|
|
580
556
|
|
|
581
557
|
#### Inputs don't focus
|
|
582
558
|
|
|
583
|
-
|
|
559
|
+
- When inputs don't focus or elements don't respond to tap, look at the order of the view hierarchy, sometimes the issue could be due to ordering of rendered components, prefer putting MapView as the first component.
|
|
584
560
|
|
|
585
561
|
Bad:
|
|
586
562
|
|
|
587
563
|
```jsx
|
|
588
564
|
<View>
|
|
589
|
-
<TextInput/>
|
|
590
|
-
<MapView/>
|
|
565
|
+
<TextInput />
|
|
566
|
+
<MapView />
|
|
591
567
|
</View>
|
|
592
568
|
```
|
|
593
569
|
|
|
@@ -595,31 +571,32 @@ Good:
|
|
|
595
571
|
|
|
596
572
|
```jsx
|
|
597
573
|
<View>
|
|
598
|
-
<MapView/>
|
|
599
|
-
<TextInput/>
|
|
574
|
+
<MapView />
|
|
575
|
+
<TextInput />
|
|
600
576
|
</View>
|
|
601
577
|
```
|
|
602
578
|
|
|
603
579
|
#### Children Components Not Re-Rendering
|
|
580
|
+
|
|
604
581
|
Components that aren't declared by this library (Ex: Markers, Polyline) must not be children of the MapView component due to MapView's unique rendering methodology. Have your custom components / views outside the MapView component and position absolute to ensure they only re-render as needed.
|
|
605
582
|
Example:
|
|
606
583
|
Bad:
|
|
607
584
|
|
|
608
585
|
```jsx
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
586
|
+
<View style={StyleSheet.absoluteFillObject}>
|
|
587
|
+
<MapView style={StyleSheet.absoluteFillObject}>
|
|
588
|
+
<View style={{position: 'absolute', top: 100, left: 50}} />
|
|
589
|
+
</MapView>
|
|
590
|
+
</View>
|
|
614
591
|
```
|
|
615
592
|
|
|
616
593
|
Good:
|
|
617
594
|
|
|
618
595
|
```jsx
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
596
|
+
<View style={StyleSheet.absoluteFillObject}>
|
|
597
|
+
<MapView style={StyleSheet.absoluteFillObject} />
|
|
598
|
+
<View style={{position: 'absolute', top: 100, left: 50}} />
|
|
599
|
+
</View>
|
|
623
600
|
```
|
|
624
601
|
|
|
625
602
|
Source: https://github.com/react-native-maps/react-native-maps/issues/1901
|
|
@@ -630,8 +607,7 @@ Source: https://github.com/react-native-maps/react-native-maps/issues/1901
|
|
|
630
607
|
|
|
631
608
|
Source: https://github.com/react-native-maps/react-native-maps/issues/3957#issuecomment-924161121
|
|
632
609
|
|
|
633
|
-
License
|
|
634
|
-
--------
|
|
610
|
+
## License
|
|
635
611
|
|
|
636
612
|
Copyright (c) 2017 Airbnb
|
|
637
613
|
|
package/android/build.gradle
CHANGED
|
@@ -20,11 +20,11 @@ buildscript {
|
|
|
20
20
|
apply plugin: 'com.android.library'
|
|
21
21
|
|
|
22
22
|
android {
|
|
23
|
-
compileSdkVersion safeExtGet('compileSdkVersion',
|
|
23
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 31)
|
|
24
24
|
|
|
25
25
|
defaultConfig {
|
|
26
26
|
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
27
|
-
targetSdkVersion safeExtGet('targetSdkVersion',
|
|
27
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 31)
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -43,11 +43,10 @@ repositories {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
dependencies {
|
|
46
|
-
def work_version = safeExtGet('targetSdkVersion', 27) < 31 ? "2.5.0" : "2.7.1"
|
|
47
46
|
implementation 'com.facebook.react:react-native:+'
|
|
48
47
|
implementation "com.google.android.gms:play-services-base:${safeExtGet('playServicesVersion', '18.1.0')}"
|
|
49
48
|
implementation "com.google.android.gms:play-services-maps:${safeExtGet('playServicesVersion', '18.0.2')}"
|
|
50
49
|
implementation "com.google.android.gms:play-services-location:20.0.0"
|
|
51
50
|
implementation 'com.google.maps.android:android-maps-utils:0.5'
|
|
52
|
-
implementation "androidx.work:work-runtime
|
|
51
|
+
implementation "androidx.work:work-runtime:2.7.1"
|
|
53
52
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
5
5
|
import com.facebook.react.views.view.ReactViewGroup;
|
|
6
6
|
|
|
7
|
-
public class
|
|
7
|
+
public class MapCallout extends ReactViewGroup {
|
|
8
8
|
private boolean tooltip = false;
|
|
9
9
|
public int width;
|
|
10
10
|
public int height;
|
|
11
11
|
|
|
12
|
-
public
|
|
12
|
+
public MapCallout(Context context) {
|
|
13
13
|
super(context);
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import androidx.annotation.Nullable;
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ import com.facebook.react.uimanager.annotations.ReactProp;
|
|
|
10
10
|
|
|
11
11
|
import java.util.Map;
|
|
12
12
|
|
|
13
|
-
public class
|
|
13
|
+
public class MapCalloutManager extends ViewGroupManager<MapCallout> {
|
|
14
14
|
|
|
15
15
|
@Override
|
|
16
16
|
public String getName() {
|
|
@@ -18,12 +18,12 @@ public class AirMapCalloutManager extends ViewGroupManager<AirMapCallout> {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
@Override
|
|
21
|
-
public
|
|
22
|
-
return new
|
|
21
|
+
public MapCallout createViewInstance(ThemedReactContext context) {
|
|
22
|
+
return new MapCallout(context);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@ReactProp(name = "tooltip", defaultBoolean = false)
|
|
26
|
-
public void setTooltip(
|
|
26
|
+
public void setTooltip(MapCallout view, boolean tooltip) {
|
|
27
27
|
view.setTooltip(tooltip);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -42,7 +42,7 @@ public class AirMapCalloutManager extends ViewGroupManager<AirMapCallout> {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
@Override
|
|
45
|
-
public void updateExtraData(
|
|
45
|
+
public void updateExtraData(MapCallout view, Object extraData) {
|
|
46
46
|
// This method is called from the shadow node with the width/height of the rendered
|
|
47
47
|
// marker view.
|
|
48
48
|
//noinspection unchecked
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ import com.google.android.gms.maps.model.Circle;
|
|
|
7
7
|
import com.google.android.gms.maps.model.CircleOptions;
|
|
8
8
|
import com.google.android.gms.maps.model.LatLng;
|
|
9
9
|
|
|
10
|
-
public class
|
|
10
|
+
public class MapCircle extends MapFeature {
|
|
11
11
|
|
|
12
12
|
private CircleOptions circleOptions;
|
|
13
13
|
private Circle circle;
|
|
@@ -19,7 +19,7 @@ public class AirMapCircle extends AirMapFeature {
|
|
|
19
19
|
private float strokeWidth;
|
|
20
20
|
private float zIndex;
|
|
21
21
|
|
|
22
|
-
public
|
|
22
|
+
public MapCircle(Context context) {
|
|
23
23
|
super(context);
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Color;
|
|
@@ -12,10 +12,10 @@ import com.facebook.react.uimanager.ViewGroupManager;
|
|
|
12
12
|
import com.facebook.react.uimanager.annotations.ReactProp;
|
|
13
13
|
import com.google.android.gms.maps.model.LatLng;
|
|
14
14
|
|
|
15
|
-
public class
|
|
15
|
+
public class MapCircleManager extends ViewGroupManager<MapCircle> {
|
|
16
16
|
private final DisplayMetrics metrics;
|
|
17
17
|
|
|
18
|
-
public
|
|
18
|
+
public MapCircleManager(ReactApplicationContext reactContext) {
|
|
19
19
|
super();
|
|
20
20
|
metrics = new DisplayMetrics();
|
|
21
21
|
((WindowManager) reactContext.getSystemService(Context.WINDOW_SERVICE))
|
|
@@ -29,38 +29,38 @@ public class AirMapCircleManager extends ViewGroupManager<AirMapCircle> {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@Override
|
|
32
|
-
public
|
|
33
|
-
return new
|
|
32
|
+
public MapCircle createViewInstance(ThemedReactContext context) {
|
|
33
|
+
return new MapCircle(context);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@ReactProp(name = "center")
|
|
37
|
-
public void setCenter(
|
|
37
|
+
public void setCenter(MapCircle view, ReadableMap center) {
|
|
38
38
|
view.setCenter(new LatLng(center.getDouble("latitude"), center.getDouble("longitude")));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@ReactProp(name = "radius", defaultDouble = 0)
|
|
42
|
-
public void setRadius(
|
|
42
|
+
public void setRadius(MapCircle view, double radius) {
|
|
43
43
|
view.setRadius(radius);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
@ReactProp(name = "strokeWidth", defaultFloat = 1f)
|
|
47
|
-
public void setStrokeWidth(
|
|
47
|
+
public void setStrokeWidth(MapCircle view, float widthInPoints) {
|
|
48
48
|
float widthInScreenPx = metrics.density * widthInPoints; // done for parity with iOS
|
|
49
49
|
view.setStrokeWidth(widthInScreenPx);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@ReactProp(name = "fillColor", defaultInt = Color.RED, customType = "Color")
|
|
53
|
-
public void setFillColor(
|
|
53
|
+
public void setFillColor(MapCircle view, int color) {
|
|
54
54
|
view.setFillColor(color);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
@ReactProp(name = "strokeColor", defaultInt = Color.RED, customType = "Color")
|
|
58
|
-
public void setStrokeColor(
|
|
58
|
+
public void setStrokeColor(MapCircle view, int color) {
|
|
59
59
|
view.setStrokeColor(color);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
@ReactProp(name = "zIndex", defaultFloat = 1.0f)
|
|
63
|
-
public void setZIndex(
|
|
63
|
+
public void setZIndex(MapCircle view, float zIndex) {
|
|
64
64
|
view.setZIndex(zIndex);
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
5
5
|
import com.facebook.react.views.view.ReactViewGroup;
|
|
6
6
|
import com.google.android.gms.maps.GoogleMap;
|
|
7
7
|
|
|
8
|
-
public abstract class
|
|
9
|
-
public
|
|
8
|
+
public abstract class MapFeature extends ReactViewGroup {
|
|
9
|
+
public MapFeature(Context context) {
|
|
10
10
|
super(context);
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.graphics.Bitmap;
|
|
@@ -30,7 +30,7 @@ import java.util.List;
|
|
|
30
30
|
* from Dagothig/ColoredPolylineOverlay
|
|
31
31
|
* (https://gist.github.com/Dagothig/5f9cf0a4a7a42901a7b2)
|
|
32
32
|
*/
|
|
33
|
-
public class
|
|
33
|
+
public class MapGradientPolyline extends MapFeature {
|
|
34
34
|
private List<LatLng> points;
|
|
35
35
|
private int[] colors;
|
|
36
36
|
private float zIndex;
|
|
@@ -41,7 +41,7 @@ public class AirMapGradientPolyline extends AirMapFeature {
|
|
|
41
41
|
private TileOverlay tileOverlay;
|
|
42
42
|
protected final Context context;
|
|
43
43
|
|
|
44
|
-
public
|
|
44
|
+
public MapGradientPolyline(Context context) {
|
|
45
45
|
super(context);
|
|
46
46
|
this.context = context;
|
|
47
47
|
}
|