@rnmapbox/maps 10.0.0-beta.72 → 10.0.0-beta.73

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.
Files changed (23) hide show
  1. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/RCTMGLPackage.java +2 -0
  2. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/annotation/RCTMGLPointAnnotation.kt +0 -1
  3. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImage.kt +74 -0
  4. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImageManager.kt +67 -0
  5. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImages.kt +62 -35
  6. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.kt +216 -0
  7. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/layers/RCTLayer.kt +2 -1
  8. package/index.d.ts +3 -2
  9. package/javascript/components/Image.tsx +12 -4
  10. package/javascript/components/annotations/Annotation.js +9 -10
  11. package/javascript/modules/location/locationManager.ts +1 -1
  12. package/lib/commonjs/components/Image.js.map +1 -1
  13. package/lib/commonjs/components/annotations/Annotation.js +6 -9
  14. package/lib/commonjs/components/annotations/Annotation.js.map +1 -1
  15. package/lib/module/components/Image.js.map +1 -1
  16. package/lib/module/components/annotations/Annotation.js +6 -9
  17. package/lib/module/components/annotations/Annotation.js.map +1 -1
  18. package/lib/typescript/components/Image.d.ts +10 -4
  19. package/lib/typescript/components/Image.d.ts.map +1 -1
  20. package/lib/typescript/modules/location/locationManager.d.ts +1 -1
  21. package/lib/typescript/modules/location/locationManager.d.ts.map +1 -1
  22. package/package.json +1 -1
  23. package/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/images/RCTMGLImagesManager.java +0 -103
@@ -15,6 +15,7 @@ import com.mapbox.rctmgl.components.camera.RCTMGLCameraManager;
15
15
  import com.mapbox.rctmgl.components.annotation.RCTMGLCalloutManager;
16
16
  import com.mapbox.rctmgl.components.annotation.RCTMGLPointAnnotationManager;
17
17
  import com.mapbox.rctmgl.components.annotation.RCTMGLMarkerViewManager;
18
+ import com.mapbox.rctmgl.components.images.RCTMGLImageManager;
18
19
  import com.mapbox.rctmgl.components.images.RCTMGLImagesManager;
19
20
  import com.mapbox.rctmgl.components.location.RCTMGLNativeUserLocationManager;
20
21
  import com.mapbox.rctmgl.components.mapview.RCTMGLMapViewManager;
@@ -94,6 +95,7 @@ public class RCTMGLPackage implements ReactPackage {
94
95
 
95
96
  // images
96
97
  managers.add(new RCTMGLImagesManager(reactApplicationContext));
98
+ managers.add(new RCTMGLImageManager(reactApplicationContext));
97
99
 
98
100
  // layers
99
101
  managers.add(new RCTMGLFillLayerManager());
@@ -53,7 +53,6 @@ class RCTMGLPointAnnotation(private val mContext: Context, private val mManager:
53
53
  childView.addOnLayoutChangeListener(this)
54
54
 
55
55
  mMapView?.offscreenAnnotationViewContainer?.addView(childView)
56
-
57
56
  }
58
57
 
59
58
  override fun removeView(childView: View) {
@@ -0,0 +1,74 @@
1
+ package com.mapbox.rctmgl.components.images
2
+
3
+ import android.graphics.Bitmap
4
+ import android.view.View
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.annotations.ReactProp
7
+ import com.facebook.react.views.view.ReactViewGroup
8
+ import com.mapbox.maps.ImageContent
9
+ import com.mapbox.maps.ImageStretches
10
+ import com.mapbox.rctmgl.components.annotation.RCTMGLCallout
11
+ import com.mapbox.rctmgl.components.mapview.RCTMGLMapView
12
+ import com.mapbox.rctmgl.utils.BitmapUtils
13
+ import com.mapbox.rctmgl.utils.Logger
14
+
15
+ class RCTMGLImage(private val mContext: ReactApplicationContext, private val mManager: RCTMGLImageManager): ReactViewGroup(mContext), View.OnLayoutChangeListener {
16
+ var name: String? = null
17
+ var sdf: Boolean = false
18
+ var scale: Double = 1.0
19
+ var stretchX = listOf<ImageStretches>();
20
+ var stretchY = listOf<ImageStretches>();
21
+ var content: ImageContent? = null;
22
+
23
+ var mChildView: View? = null;
24
+
25
+ var mMapView: RCTMGLMapView? = null;
26
+
27
+ var nativeImageUpdater: NativeImageUpdater? = null;
28
+
29
+ var mBitmap : Bitmap? = null
30
+
31
+ override fun onLayoutChange(v: View, left: Int, top: Int, right: Int, bottom: Int, oldLeft: Int, oldTop: Int,
32
+ oldRight: Int, oldBottom: Int) {
33
+ if (left == 0 && top == 0 && right == 0 && bottom == 0) {
34
+ return
35
+ }
36
+ if (left != oldLeft || right != oldRight || top != oldTop || bottom != oldBottom) {
37
+ refreshBitmap(v, left, top, right, bottom)
38
+ }
39
+ }
40
+
41
+ private fun refreshBitmap(v: View, left: Int = v.left, top: Int = v.top, right: Int = v.right, bottom: Int = v.bottom) {
42
+ val name = this.name
43
+ if (name == null) {
44
+ Logger.e("RCTMGLImage", "Image component has no name")
45
+ return
46
+ }
47
+ val bitmap = BitmapUtils.viewToBitmap(v, left, top, right, bottom)
48
+ nativeImageUpdater?.let {
49
+ it.updateImage(name, bitmap, sdf, stretchX, stretchY, content, scale)
50
+ mBitmap = null;
51
+ }
52
+ }
53
+
54
+ fun refresh() {
55
+ mChildView?.let {
56
+ refreshBitmap(it)
57
+ }
58
+ }
59
+
60
+ override fun addView(childView: View, childPosition: Int) {
61
+ if (childPosition != 0) {
62
+ Logger.e("RCTMGLImage", "expected a single subview got childView:$childView position:$childPosition")
63
+ }
64
+ mMapView?.offscreenAnnotationViewContainer?.addView(childView)
65
+ mChildView = childView
66
+ childView.addOnLayoutChangeListener(this)
67
+ }
68
+
69
+ // region add/remove to Map
70
+ fun addToMap(mapView: RCTMGLMapView) {
71
+ mMapView = mapView
72
+ }
73
+ // endregion
74
+ }
@@ -0,0 +1,67 @@
1
+ package com.mapbox.rctmgl.components.images
2
+
3
+ import com.facebook.react.bridge.Dynamic
4
+ import com.facebook.react.bridge.DynamicFromArray
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.bridge.ReadableArray
7
+ import com.facebook.react.common.MapBuilder
8
+ import com.facebook.react.uimanager.ThemedReactContext
9
+ import com.facebook.react.uimanager.annotations.ReactProp
10
+ import com.mapbox.rctmgl.components.AbstractEventEmitter
11
+ import com.mapbox.rctmgl.events.constants.EventKeys
12
+
13
+ class RCTMGLImageManager(private val mContext: ReactApplicationContext) : AbstractEventEmitter<RCTMGLImage>(
14
+ mContext
15
+ ) {
16
+ override fun getName(): String {
17
+ return "RCTMGLImage"
18
+ }
19
+
20
+ override fun createViewInstance(p0: ThemedReactContext): RCTMGLImage {
21
+ return RCTMGLImage(mContext, this)
22
+ }
23
+
24
+ override fun customEvents(): MutableMap<String, String>? {
25
+ return mutableMapOf();
26
+ }
27
+
28
+ // region React properties
29
+ @ReactProp(name="name")
30
+ fun setName(image: RCTMGLImage, value: String) {
31
+ image.name = value
32
+ }
33
+
34
+ @ReactProp(name="sdf")
35
+ fun setSdf(image: RCTMGLImage, value: Boolean) {
36
+ image.sdf = value
37
+ }
38
+
39
+ @ReactProp(name="stretchX")
40
+ fun setStretchX(image: RCTMGLImage, value: Dynamic) {
41
+ image.stretchX = RCTMGLImagesManager.convertStretch(value) ?: listOf()
42
+ }
43
+
44
+ @ReactProp(name="stretchY")
45
+ fun setStretchY(image: RCTMGLImage, value: Dynamic) {
46
+ image.stretchY = RCTMGLImagesManager.convertStretch(value) ?: listOf()
47
+ }
48
+
49
+ @ReactProp(name="content")
50
+ fun setContent(image: RCTMGLImage, value: Dynamic) {
51
+ image.content = RCTMGLImagesManager.convertContent(value)
52
+ }
53
+
54
+ @ReactProp(name="scale")
55
+ fun setScale(image: RCTMGLImage, value: Double) {
56
+ image.scale = value
57
+ }
58
+ // endregion
59
+
60
+ // region React methods
61
+ override fun receiveCommand(root: RCTMGLImage, commandId: String?, args: ReadableArray?) {
62
+ if (commandId == "refresh") {
63
+ root.refresh()
64
+ }
65
+ }
66
+ // endregion
67
+ }
@@ -10,6 +10,8 @@ import androidx.core.content.res.ResourcesCompat
10
10
  import com.mapbox.bindgen.Expected
11
11
  import com.mapbox.bindgen.None
12
12
  import com.mapbox.maps.Image
13
+ import com.mapbox.maps.ImageContent
14
+ import com.mapbox.maps.ImageStretches
13
15
  import com.mapbox.maps.MapboxMap
14
16
  import com.mapbox.maps.Style
15
17
  import com.mapbox.rctmgl.R
@@ -24,28 +26,40 @@ import java.util.ArrayList
24
26
  import java.util.HashMap
25
27
  import java.util.HashSet
26
28
 
27
- fun Style.addBitmapImage(imageId: String, bitmap: Bitmap) : Expected<String, None> {
29
+ fun Style.addBitmapImage(imageId: String, bitmap: Bitmap, sdf: Boolean = false, stretchX: List<ImageStretches> = listOf(), stretchY: List<ImageStretches> = listOf(), content: ImageContent? = null, scale: Double = 1.0) : Expected<String, None> {
28
30
  val byteBuffer = ByteBuffer.allocate(bitmap.byteCount)
29
31
  bitmap.copyPixelsToBuffer(byteBuffer)
30
- val sdf = false
31
32
  return this.addStyleImage(
32
33
  imageId,
33
- (1.0/((160.0/bitmap.density))).toFloat(),
34
+ (1.0/((160.0/bitmap.density)) * scale).toFloat() ,
34
35
  Image(bitmap.width, bitmap.height, byteBuffer.array()),
35
36
  sdf,
36
- listOf(),
37
- listOf(),
38
- null
37
+ stretchX,
38
+ stretchY,
39
+ content,
39
40
  )
40
41
  }
41
42
 
42
- class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager) : AbstractMapFeature(context) {
43
+ fun Style.addBitmapImage(nativeImage: NativeImage) : Expected<String, None> {
44
+ return addBitmapImage(nativeImage.name, nativeImage.drawable.bitmap, nativeImage.sdf, nativeImage.stretchX, nativeImage.stretchY, nativeImage.content, nativeImage.scale)
45
+ }
46
+
47
+ data class NativeImage(val name: String, val drawable: BitmapDrawable, val scale: Double = 1.0, val sdf: Boolean = false, val stretchX: List<ImageStretches> = listOf(),
48
+ val stretchY: List<ImageStretches> = listOf(), val content: ImageContent? = null
49
+ );
50
+
51
+ interface NativeImageUpdater {
52
+ fun updateImage(imageId: String, bitmap: Bitmap, sdf: Boolean = false, stretchX: List<ImageStretches> = listOf(), stretchY: List<ImageStretches> = listOf(), content: ImageContent? = null, scale: Double = 1.0)
53
+ }
54
+
55
+ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager) : AbstractMapFeature(context), NativeImageUpdater {
43
56
  var mCurrentImages: MutableSet<String?>
57
+ var mImageViews = mutableListOf<RCTMGLImage>();
44
58
  private var mImages: MutableMap<String, ImageEntry>?
45
- private var mNativeImages: MutableMap<String?, BitmapDrawable?>?
59
+ private var mNativeImages = mutableMapOf<String, NativeImage>()
46
60
  private var mSendMissingImageEvents = false
47
61
  private var mMap: MapboxMap? = null
48
- var iD: String? = null
62
+
49
63
  fun setImages(images: List<Map.Entry<String, ImageEntry>>) {
50
64
  val newImages: MutableMap<String, ImageEntry> = HashMap()
51
65
  for ((key, value) in images) {
@@ -59,16 +73,18 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
59
73
  }
60
74
  }
61
75
 
62
- fun setNativeImages(nativeImages: List<Map.Entry<String, BitmapDrawable>>) {
63
- val newImages: MutableMap<String?, BitmapDrawable?> = HashMap()
64
- for ((key, value) in nativeImages) {
65
- val oldValue = mNativeImages?.put(key, value)
76
+ fun setNativeImages(nativeImages: List<NativeImage>) {
77
+ val newImages: MutableMap<String, NativeImage> = HashMap()
78
+ for (nativeImage in nativeImages) {
79
+ val oldValue = mNativeImages.put(nativeImage.name, nativeImage)
66
80
  if (oldValue == null) {
67
- newImages[key] = value
81
+ newImages[nativeImage.name] = nativeImage
68
82
  }
69
83
  }
70
- if (mMap != null && mMap?.getStyle() != null) {
71
- addNativeImagesToStyle(newImages, mMap!!)
84
+ mMap?.let {
85
+ if (it.getStyle() != null) {
86
+ addNativeImagesToStyle(newImages, it)
87
+ }
72
88
  }
73
89
  }
74
90
 
@@ -79,7 +95,7 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
79
95
  override fun removeFromMap(mapView: RCTMGLMapView) {
80
96
  removeImages(mapView)
81
97
  mMap = null
82
- mNativeImages = HashMap()
98
+ mNativeImages = mutableMapOf()
83
99
  mImages = HashMap()
84
100
  mCurrentImages = HashSet()
85
101
  super.removeFromMap(mapView)
@@ -111,12 +127,10 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
111
127
  }
112
128
 
113
129
  fun addMissingImageToStyle(id: String, map: MapboxMap): Boolean {
114
- if (mNativeImages != null) {
115
- val drawable = mNativeImages!![id]
116
- if (drawable != null) {
117
- addNativeImages(entry<String?, BitmapDrawable?>(id, drawable), map)
118
- return true
119
- }
130
+ val nativeImage = mNativeImages.get(id)
131
+ if (nativeImage != null) {
132
+ addNativeImages(listOf(nativeImage), map)
133
+ return true
120
134
  }
121
135
  if (mImages != null) {
122
136
  val entry = mImages!![id]
@@ -134,10 +148,8 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
134
148
  }
135
149
  }
136
150
 
137
- fun addNativeImagesToStyle(images: Map<String?, BitmapDrawable?>?, map: MapboxMap) {
138
- if (images != null) {
139
- addNativeImages(ArrayList(images.entries), map)
140
- }
151
+ fun addNativeImagesToStyle(images: Map<String, NativeImage>, map: MapboxMap) {
152
+ addNativeImages(images.values.toList(), map)
141
153
  }
142
154
 
143
155
  fun sendImageMissingEvent(id: String, map: MapboxMap) {
@@ -153,6 +165,10 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
153
165
 
154
166
  override fun addToMap(mapView: RCTMGLMapView) {
155
167
  super.addToMap(mapView)
168
+
169
+ mImageViews.forEach {
170
+ it.addToMap(mapView)
171
+ }
156
172
  // Wait for style before adding the source to the map
157
173
  // only then we can pre-load required images / placeholders into the style
158
174
  // before we add the ShapeSource to the map
@@ -163,18 +179,22 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
163
179
  addNativeImagesToStyle(mNativeImages, map)
164
180
  addImagesToStyle(mImages, map)
165
181
  // super.addToMap(mapView);
182
+
183
+ mImageViews.forEach {
184
+ it.refresh()
185
+ }
166
186
  }
167
187
  })
168
188
  }
169
189
 
170
- private fun addNativeImages(imageEntries: List<Map.Entry<String?, BitmapDrawable?>>?, map: MapboxMap) {
190
+ private fun addNativeImages(imageEntries: List<NativeImage>, map: MapboxMap) {
171
191
  val style = map.getStyle()
172
- if (style == null || imageEntries == null) return
173
- for ((key, value) in imageEntries) {
174
- if (key != null && !hasImage(key, map)) {
175
- val bitmap = value!!.bitmap
176
- style.addBitmapImage(key, bitmap)
177
- mCurrentImages.add(key)
192
+ if (style == null) return
193
+ for (nativeImage in imageEntries) {
194
+ if (!hasImage(nativeImage.name, map)) {
195
+ val bitmap = nativeImage.drawable
196
+ style.addBitmapImage(nativeImage)
197
+ mCurrentImages.add(nativeImage.name)
178
198
  }
179
199
  }
180
200
  }
@@ -193,7 +213,7 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
193
213
  // See also: https://github.com/mapbox/mapbox-gl-native/pull/14253#issuecomment-478827792
194
214
  for (imageEntry in imageEntries) {
195
215
  if (!hasImage(imageEntry.key, map)) {
196
- mImagePlaceholder?.let { style.addBitmapImage(imageEntry.key, it) }
216
+ mImagePlaceholder?.let { style.addBitmapImage(imageEntry.key, it, false, listOf(), listOf(), null,1.0) }
197
217
  missingImages.add(imageEntry)
198
218
  mCurrentImages.add(imageEntry.key)
199
219
  }
@@ -220,4 +240,11 @@ class RCTMGLImages(context: Context, private val mManager: RCTMGLImagesManager)
220
240
  mImagePlaceholder = BitmapUtils.getBitmapFromDrawable(ResourcesCompat.getDrawable(context.resources, R.drawable.empty_drawable, null))
221
241
  }
222
242
  }
243
+
244
+ override fun updateImage(imageId: String, bitmap: Bitmap, sdf: Boolean, stretchX: List<ImageStretches>, stretchY: List<ImageStretches>, content: ImageContent?, scale: Double)
245
+ {
246
+ mMap?.getStyle()?.let {
247
+ it.addBitmapImage(imageId, bitmap, sdf, stretchX, stretchY, content, scale);
248
+ }
249
+ }
223
250
  }
@@ -0,0 +1,216 @@
1
+ package com.mapbox.rctmgl.components.images
2
+
3
+ import android.graphics.drawable.BitmapDrawable
4
+ import android.view.View
5
+ import com.facebook.react.bridge.*
6
+ import com.facebook.react.common.MapBuilder
7
+ import com.facebook.react.uimanager.ThemedReactContext
8
+ import com.facebook.react.uimanager.annotations.ReactProp
9
+ import com.mapbox.maps.ImageContent
10
+ import com.mapbox.maps.ImageStretches
11
+ import com.mapbox.rctmgl.components.AbstractEventEmitter
12
+ import com.mapbox.rctmgl.components.mapview.RCTMGLMapView
13
+ import com.mapbox.rctmgl.events.constants.EventKeys
14
+ import com.mapbox.rctmgl.modules.RCTMGLLogging
15
+ import com.mapbox.rctmgl.utils.ImageEntry
16
+ import com.mapbox.rctmgl.utils.Logger
17
+ import com.mapbox.rctmgl.utils.ResourceUtils
18
+ import java.util.*
19
+
20
+ class RCTMGLImagesManager(private val mContext: ReactApplicationContext) :
21
+ AbstractEventEmitter<RCTMGLImages?>(
22
+ mContext
23
+ ) {
24
+ override fun getName(): String {
25
+ return "RCTMGLImages"
26
+ }
27
+
28
+ public override fun createViewInstance(context: ThemedReactContext): RCTMGLImages {
29
+ return RCTMGLImages(context, this)
30
+ }
31
+
32
+ @ReactProp(name = "images")
33
+ fun setImages(images: RCTMGLImages, map: ReadableMap) {
34
+ val imagesList: MutableList<Map.Entry<String, ImageEntry>> = ArrayList()
35
+ val iterator = map.keySetIterator()
36
+ while (iterator.hasNextKey()) {
37
+ val imageName = iterator.nextKey()
38
+ var imageEntry: ImageEntry? = null
39
+ imageEntry = if (map.getType(imageName) == ReadableType.Map) {
40
+ val imageMap = map.getMap(imageName)
41
+ val uri = imageMap!!.getString("uri")
42
+ val hasScale =
43
+ imageMap.hasKey("scale") && imageMap.getType("scale") == ReadableType.Number
44
+ val scale = if (hasScale) imageMap.getDouble("scale") else ImageEntry.defaultScale
45
+ ImageEntry(uri, scale)
46
+ } else {
47
+ ImageEntry(map.getString(imageName))
48
+ }
49
+ imagesList.add(AbstractMap.SimpleEntry(imageName, imageEntry))
50
+ }
51
+ images.setImages(imagesList)
52
+ }
53
+
54
+ @ReactProp(name = "hasOnImageMissing")
55
+ fun setHasOnImageMissing(images: RCTMGLImages, value: Boolean?) {
56
+ images.setHasOnImageMissing(value!!)
57
+ }
58
+
59
+ fun toNativeImage(dynamic: Dynamic): NativeImage? {
60
+ when (dynamic.type) {
61
+ ReadableType.String -> {
62
+ val resourceName = dynamic.asString();
63
+ val drawable =
64
+ ResourceUtils.getDrawableByName(mContext, resourceName) as BitmapDrawable
65
+ if (drawable != null) {
66
+ return NativeImage(name, drawable)
67
+ } else {
68
+ Logger.e("RCTMGLImages", "cound not get native drawable with name: $name")
69
+ return null
70
+ }
71
+ }
72
+ ReadableType.Map -> {
73
+ val map = dynamic.asMap()
74
+ val resourceName = map.getString("name")
75
+ var sdf = false
76
+ var stretchX = listOf<ImageStretches>();
77
+ var stretchY = listOf<ImageStretches>();
78
+ var content : ImageContent? = null;
79
+ var scale : Double = 1.0;
80
+ if (map.hasKey("sdf")) {
81
+ sdf = map.getBoolean("sdf");
82
+ }
83
+ if (map.hasKey("stretchX")) {
84
+ stretchX = convertStretch(map.getDynamic("stretchX")) ?: listOf()
85
+ }
86
+ if (map.hasKey("stretchY")) {
87
+ stretchY = convertStretch(map.getDynamic("stretchY")) ?: listOf()
88
+ }
89
+ if (map.hasKey("content")) {
90
+ content = convertContent(map.getDynamic("content")) ?: null
91
+ }
92
+ if (map.hasKey("scale")) {
93
+ if (map.getType("scale") != ReadableType.Number) {
94
+ Logger.e("RCTMGLImages", "scale should be a number found: $scale in $dynamic")
95
+ return null
96
+ }
97
+ scale = map.getDouble("scale")
98
+ }
99
+ val drawable =
100
+ ResourceUtils.getDrawableByName(mContext, resourceName) as BitmapDrawable
101
+ if (drawable != null) {
102
+ return NativeImage(name, drawable, scale, sdf, stretchX, stretchY)
103
+ } else {
104
+ Logger.e("RCTMGLImages", "cound not get native drawable with name: $name")
105
+ return null
106
+ }
107
+ }
108
+ else -> {
109
+ Logger.e("RCTMGLImages", "nativeImages element should be a string or a object, but was: $dynamic")
110
+ return null
111
+ }
112
+ }
113
+ }
114
+
115
+ @ReactProp(name = "nativeImages")
116
+ fun setNativeImages(images: RCTMGLImages, arr: ReadableArray) {
117
+ val nativeImages = mutableListOf<NativeImage>();
118
+ for (i in 0 until arr.size()) {
119
+ val nativeImage = toNativeImage(arr.getDynamic(i))
120
+ if (nativeImage != null) {
121
+ nativeImages.add(nativeImage)
122
+ }
123
+ }
124
+ images.setNativeImages(nativeImages)
125
+ }
126
+
127
+ override fun customEvents(): Map<String, String>? {
128
+ return MapBuilder.builder<String, String>()
129
+ .put(EventKeys.IMAGES_MISSING, "onImageMissing")
130
+ .build()
131
+ }
132
+
133
+ // region RCTMGLImage children
134
+
135
+ override fun addView(parent: RCTMGLImages?, childView: View?, childPosition: Int) {
136
+ if (parent == null || childView == null) {
137
+ Logger.e("RCTMGLImages", "addView: parent or childView is null")
138
+ return
139
+ }
140
+
141
+ if (childView !is RCTMGLImage) {
142
+ Logger.e("RCTMGLImages", "child view should be RCTMGLImage")
143
+ return
144
+ }
145
+
146
+ parent.mImageViews.add(childPosition, childView)
147
+ childView.nativeImageUpdater = parent
148
+ }
149
+
150
+ override fun removeView(parent: RCTMGLImages?, view: View?) {
151
+ if (parent == null || view == null) {
152
+ Logger.e("RCTMGLImages", "removeView: parent or view is null")
153
+ return
154
+ }
155
+
156
+ parent.mImageViews.remove(view)
157
+ }
158
+
159
+ override fun removeAllViews(parent: RCTMGLImages?) {
160
+ if (parent == null) {
161
+ Logger.e("RCTMGLImages", "removeAllViews parent is null")
162
+ return
163
+ }
164
+
165
+ parent.mImageViews.clear()
166
+ }
167
+
168
+ // endregion
169
+
170
+ companion object {
171
+ const val REACT_CLASS = "RCTMGLImages"
172
+
173
+ fun convertStretch(stretch: Dynamic) : List<ImageStretches>? {
174
+ if (stretch.type != ReadableType.Array) {
175
+ Logger.e("RCTMGLImages", "stretch should be an array, got $stretch")
176
+ return null
177
+ }
178
+ val array = stretch.asArray()
179
+ var result = mutableListOf<ImageStretches>();
180
+ for (i in 0 until array.size()) {
181
+ if (array.getType(i) != ReadableType.Array) {
182
+ Logger.e("RTMGLImages", "each element of strech should be an array but was: ${array.getDynamic(i)}")
183
+ } else {
184
+ val pair = array.getArray(i)
185
+ if (pair.size() != 2 || pair.getType(0) != ReadableType.Number || pair.getType(1) != ReadableType.Number) {
186
+ Logger.e("RCTMGLImages", "each element of stretch should be pair of 2 integers but was ${pair}")
187
+ }
188
+ result.add(ImageStretches(pair.getDouble(0).toFloat(), pair.getDouble(1).toFloat()))
189
+ }
190
+ }
191
+ return result;
192
+ }
193
+
194
+ fun convertContent(content: Dynamic) : ImageContent? {
195
+ if (content.type != ReadableType.Array) {
196
+ Logger.e("RCTMGLImages", "content should be an array, got $content")
197
+ return null
198
+ }
199
+ val array = content.asArray()
200
+ if (array.size() != 4) {
201
+ Logger.e("RCTMGLImages", "content should be an array of 4 numbers, got $content")
202
+ return null
203
+ }
204
+ val result = arrayOf(0.0, 0.0, 0.0, 0.0, 0.0)
205
+ for (i in 0 until array.size()) {
206
+ if (array.getType(i) != ReadableType.Number) {
207
+ Logger.e("RTMGLImages", "each element of content should be an number but was : ${array}")
208
+ return null
209
+ } else {
210
+ result[i] = array.getDouble(i)
211
+ }
212
+ }
213
+ return ImageContent(result[0].toFloat(), result[1].toFloat() ,result[2].toFloat(), result[3].toFloat())
214
+ }
215
+ }
216
+ }
@@ -11,6 +11,7 @@ import com.mapbox.maps.MapboxMap
11
11
  import com.facebook.react.bridge.ReadableArray
12
12
  import com.mapbox.rctmgl.components.mapview.RCTMGLMapView.FoundLayerCallback
13
13
  import com.facebook.common.logging.FLog
14
+ import com.mapbox.maps.extension.style.expressions.dsl.generated.all
14
15
  import com.mapbox.maps.extension.style.expressions.dsl.generated.literal
15
16
  import com.mapbox.maps.extension.style.expressions.generated.Expression
16
17
  import com.mapbox.maps.extension.style.layers.*
@@ -115,7 +116,7 @@ abstract class RCTLayer<T : Layer?>(protected var mContext: Context) : AbstractS
115
116
  mHadFilter = true
116
117
  updateFilter(mFilter)
117
118
  } else if (mHadFilter) {
118
- updateFilter(literal(true))
119
+ updateFilter(/* literal(true)*/all {} )
119
120
  }
120
121
  }
121
122
  }
package/index.d.ts CHANGED
@@ -78,7 +78,6 @@ import type {
78
78
  import type { requestAndroidLocationPermissions as _requestAndroidLocationPermissions } from './javascript/requestAndroidLocationPermissions';
79
79
  import type {
80
80
  Location as _Location,
81
- Coordinates as _Coordinates,
82
81
  LocationManager,
83
82
  } from './javascript/modules/location/locationManager';
84
83
 
@@ -180,7 +179,9 @@ declare namespace MapboxGL {
180
179
  type UserTrackingMode = _UserTrackingMode;
181
180
  type UserTrackingModeChangeCallback = _UserTrackingModeChangeCallback;
182
181
  type Location = _Location;
183
- type Coordinates = _Coordinates;
182
+
183
+ /** @deprecated This will be removed in a future release. Use `Location['coords']` instead. */
184
+ type Coordinates = Location['coords'];
184
185
 
185
186
  const offlineManager: OfflineManager;
186
187
  const snapshotManager: SnapshotManager;
@@ -2,19 +2,27 @@ import React, { memo, forwardRef, ReactElement } from 'react';
2
2
  import { requireNativeComponent } from 'react-native';
3
3
 
4
4
  interface Props {
5
- /** Image name */
5
+ /** ID of the image */
6
6
  name: string;
7
7
 
8
8
  /** Make image an sdf optional - see [SDF icons](https://docs.mapbox.com/help/troubleshooting/using-recolorable-images-in-mapbox-maps/) */
9
9
  sdf?: boolean;
10
10
 
11
- /** stretch along x axis - optional */
11
+ /** An array of two-element arrays, consisting of two numbers that represent, the from position and the to position of areas that can be stretched horizontally. */
12
12
  stretchX?: [number, number][];
13
13
 
14
- /** stretch along y axis - optional */
14
+ /** An array of two-element arrays, consisting of two numbers that represent, the from position and the to position of areas that can be stretched vertically. */
15
15
  stretchY?: [number, number][];
16
16
 
17
- /** Single react native view generating the image */
17
+ /** An array of four numbers, with the first two specifying the left, top
18
+ * corner, and the last two specifying the right, bottom corner. If present, and if the
19
+ * icon uses icon-text-fit, the symbol's text will be fit inside the content box. */
20
+ content?: [number, number, number, number];
21
+
22
+ /** Scale factor for the image. */
23
+ scale?: number;
24
+
25
+ /** Single react native view rendering the image */
18
26
  children: ReactElement;
19
27
  }
20
28
 
@@ -51,11 +51,16 @@ class Annotation extends React.Component {
51
51
  prevProps.coordinates[0] !== this.props.coordinates[0] ||
52
52
  prevProps.coordinates[1] !== this.props.coordinates[1];
53
53
 
54
- if (!hasCoordChanged) {
55
- return;
56
- }
54
+ if (
55
+ prevProps.animated !== this.props.animated ||
56
+ (hasCoordChanged && (!this.state.shape || !this.props.animated))
57
+ ) {
58
+ const shape = this._getShapeFromProps(this.props);
57
59
 
58
- if (this.props.animated && this.state.shape) {
60
+ this.setState({
61
+ shape: this.props.animated ? new AnimatedPoint(shape) : shape,
62
+ });
63
+ } else if (hasCoordChanged && this.props.animated && this.state.shape) {
59
64
  // flush current animations
60
65
  this.state.shape.stopAnimation();
61
66
 
@@ -66,12 +71,6 @@ class Annotation extends React.Component {
66
71
  duration: this.props.animationDuration,
67
72
  })
68
73
  .start();
69
- } else if (!this.state.shape || !this.props.animated) {
70
- const shape = this._getShapeFromProps(this.props);
71
-
72
- this.setState({
73
- shape: this.props.animated ? new AnimatedPoint(shape) : shape,
74
- });
75
74
  }
76
75
  }
77
76
 
@@ -25,7 +25,7 @@ export interface Location {
25
25
  /**
26
26
  * Coorinates sent by locationManager
27
27
  */
28
- export interface Coordinates {
28
+ interface Coordinates {
29
29
  /**
30
30
  * The heading (measured in degrees) relative to true north.
31
31
  * Heading is used to describe the direction the device is pointing to (the value of the compass).
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Image","memo","forwardRef","_ref","ref","name","sdf","stretchX","stretchY","children","nativeProps","createElement","RCTMGLImage","NATIVE_MODULE_NAME","exports","requireNativeComponent","displayName","_default"],"sourceRoot":"../../../javascript","sources":["components/Image.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAsD,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAuBtD,MAAMW,KAAK,gBAAG,IAAAC,WAAI,gBAChB,IAAAC,iBAAU,EAAa,SAASF,KAAKA,CAAAG,IAAA,EAEnCC,GAA4B,EAC5B;EAAA,IAFA;IAAEC,IAAI;IAAEC,GAAG;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAgB,CAAC,GAAAN,IAAA;EAGlD,MAAMO,WAAW,GAAG;IAClBL,IAAI;IACJC,GAAG;IACHC,QAAQ;IACRC,QAAQ;IACRC;EACF,CAAC;EACD,oBAAOnC,MAAA,CAAAW,OAAA,CAAA0B,aAAA,CAACC,WAAW,EAAKF,WAAW,CAAI;AACzC,CAAC,CAAC,CACH;AAUM,MAAMG,kBAAkB,GAAG,aAAa;AAACC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AAEhD,MAAMD,WAAW,GAAG,IAAAG,mCAAsB,EAAcF,kBAAkB,CAAC;AAE3Eb,KAAK,CAACgB,WAAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAEbjB,KAAK;AAAAc,OAAA,CAAA7B,OAAA,GAAAgC,QAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Image","memo","forwardRef","_ref","ref","name","sdf","stretchX","stretchY","children","nativeProps","createElement","RCTMGLImage","NATIVE_MODULE_NAME","exports","requireNativeComponent","displayName","_default"],"sourceRoot":"../../../javascript","sources":["components/Image.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAsD,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iB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EC;EAAgB,CAAC,GAAAN,IAAA;EAGlD,MAAMO,WAAW,GAAG;IAClBL,IAAI;IACJC,GAAG;IACHC,QAAQ;IACRC,QAAQ;IACRC;EACF,CAAC;EACD,oBAAOnC,MAAA,CAAAW,OAAA,CAAA0B,aAAA,CAACC,WAAW,EAAKF,WAAW,CAAI;AACzC,CAAC,CAAC,CACH;AAUM,MAAMG,kBAAkB,GAAG,aAAa;AAACC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AAEhD,MAAMD,WAAW,GAAG,IAAAG,mCAAsB,EAAcF,kBAAkB,CAAC;AAE3Eb,KAAK,CAACgB,WAAW,GAAG,OAAO;AAAC,IAAAC,QAAA,GAEbjB,KAAK;AAAAc,OAAA,CAAA7B,OAAA,GAAAgC,QAAA"}
@@ -44,10 +44,12 @@ class Annotation extends _react.default.Component {
44
44
  return;
45
45
  }
46
46
  const hasCoordChanged = prevProps.coordinates[0] !== this.props.coordinates[0] || prevProps.coordinates[1] !== this.props.coordinates[1];
47
- if (!hasCoordChanged) {
48
- return;
49
- }
50
- if (this.props.animated && this.state.shape) {
47
+ if (prevProps.animated !== this.props.animated || hasCoordChanged && (!this.state.shape || !this.props.animated)) {
48
+ const shape = this._getShapeFromProps(this.props);
49
+ this.setState({
50
+ shape: this.props.animated ? new _classes.AnimatedPoint(shape) : shape
51
+ });
52
+ } else if (hasCoordChanged && this.props.animated && this.state.shape) {
51
53
  // flush current animations
52
54
  this.state.shape.stopAnimation();
53
55
  this.state.shape.timing({
@@ -55,11 +57,6 @@ class Annotation extends _react.default.Component {
55
57
  easing: this.props.animationEasingFunction,
56
58
  duration: this.props.animationDuration
57
59
  }).start();
58
- } else if (!this.state.shape || !this.props.animated) {
59
- const shape = this._getShapeFromProps(this.props);
60
- this.setState({
61
- shape: this.props.animated ? new _classes.AnimatedPoint(shape) : shape
62
- });
63
60
  }
64
61
  }
65
62
  onPress() {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_propTypes","_SymbolLayer","_Animated","_classes","obj","__esModule","default","Annotation","React","Component","propTypes","id","PropTypes","string","isRequired","animated","bool","animationDuration","number","animationEasingFunction","func","coordinates","arrayOf","onPress","children","any","style","icon","oneOfType","object","defaultProps","Easing","linear","constructor","props","shape","_getShapeFromProps","state","AnimatedPoint","bind","componentDidUpdate","prevProps","Array","isArray","setState","hasCoordChanged","stopAnimation","timing","easing","duration","start","arguments","length","undefined","lng","lat","type","symbolStyle","Object","assign","iconImage","render","createElement","ShapeSource","ref","SymbolLayer","_default","exports"],"sourceRoot":"../../../../javascript","sources":["components/annotations/Annotation.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAA8C,SAAAD,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9C,MAAMG,UAAU,SAASC,cAAK,CAACC,SAAS,CAAC;EACvC,OAAOC,SAAS,GAAG;IACjBC,EAAE,EAAEC,kBAAS,CAACC,MAAM,CAACC,UAAU;IAC/BC,QAAQ,EAAEH,kBAAS,CAACI,IAAI;IACxBC,iBAAiB,EAAEL,kBAAS,CAACM,MAAM;IACnCC,uBAAuB,EAAEP,kBAAS,CAACQ,IAAI;IACvCC,WAAW,EAAET,kBAAS,CAACU,OAAO,CAACV,kBAAS,CAACM,MAAM,CAAC;IAChDK,OAAO,EAAEX,kBAAS,CAACQ,IAAI;IACvBI,QAAQ,EAAEZ,kBAAS,CAACa,GAAG;IACvBC,KAAK,EAAEd,kBAAS,CAACa,GAAG;IACpBE,IAAI,EAAEf,kBAAS,CAACgB,SAAS,CAA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AACzB,KAAK,CAACR,KAAK,EAAE;MACzCkC,SAAS,EAAE,IAAI,CAAC1B,KAAK,CAACP;IACxB,CAAC,CAAC;EACJ;EAEAkC,MAAMA,CAAA,EAAG;IACP,IAAI,CAAC,IAAI,CAAC3B,KAAK,CAACb,WAAW,EAAE;MAC3B,OAAO,IAAI;IACb;IAEA,oBACEzB,MAAA,CAAAU,OAAA,CAAAwD,aAAA,CAAC5D,SAAA,CAAAI,OAAQ,CAACyD,WAAW;MACnBpD,EAAE,EAAE,IAAI,CAACuB,KAAK,CAACvB,EAAG;MAClBqD,GAAG,EAAC,QAAQ;MACZzC,OAAO,EAAE,IAAI,CAACA,OAAQ;MACtBY,KAAK,EAAE,IAAI,CAACE,KAAK,CAACF;IAAM,GAEvB,IAAI,CAACsB,WAAW,iBACf7D,MAAA,CAAAU,OAAA,CAAAwD,aAAA,CAAC7D,YAAA,CAAAgE,WAAW;MACVtD,EAAE,EAAG,GAAE,IAAI,CAACuB,KAAK,CAACvB,EAAG,SAAS;MAC9Be,KAAK,EAAE,IAAI,CAAC+B;IAAY,EAE3B,EACA,IAAI,CAACvB,KAAK,CAACV,QAAQ,CACC;EAE3B;AACF;AAAC,IAAA0C,QAAA,GAEc3D,UAAU;AAAA4D,OAAA,CAAA7D,OAAA,GAAA4D,QAAA"}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_propTypes","_SymbolLayer","_Animated","_classes","obj","__esModule","default","Annotation","React","Component","propTypes","id","PropTypes","string","isRequired","animated","bool","animationDuration","number","animationEasingFunction","func","coordinates","arrayOf","onPress","children","any","style","icon","oneOfType","object","defaultProps","Easing","linear","constructor","props","shape","_getShapeFromProps","state","AnimatedPoint","bind","componentDidUpdate","prevProps","Array","isArray","setState","hasCoordChanged","stopAnimation","timing","easing","duration","start","arguments","length","undefined","lng","lat","type","symbolStyle","Object","assign","iconImage","render","createElement","ShapeSource","ref","SymbolLayer","_default","exports"],"sourceRoot":"../../../../javascript","sources":["components/annotations/Annot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AI,CAACuB,KAAK,CAACvB,EAAG;MAClBqD,GAAG,EAAC,QAAQ;MACZzC,OAAO,EAAE,IAAI,CAACA,OAAQ;MACtBY,KAAK,EAAE,IAAI,CAACE,KAAK,CAACF;IAAM,GAEvB,IAAI,CAACsB,WAAW,iBACf7D,MAAA,CAAAU,OAAA,CAAAwD,aAAA,CAAC7D,YAAA,CAAAgE,WAAW;MACVtD,EAAE,EAAG,GAAE,IAAI,CAACuB,KAAK,CAACvB,EAAG,SAAS;MAC9Be,KAAK,EAAE,IAAI,CAAC+B;IAAY,EAE3B,EACA,IAAI,CAACvB,KAAK,CAACV,QAAQ,CACC;EAE3B;AACF;AAAC,IAAA0C,QAAA,GAEc3D,UAAU;AAAA4D,OAAA,CAAA7D,OAAA,GAAA4D,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["React","memo","forwardRef","requireNativeComponent","Image","_ref","ref","name","sdf","stretchX","stretchY","children","nativeProps","createElement","RCTMGLImage","NATIVE_MODULE_NAME","displayName"],"sourceRoot":"../../../javascript","sources":["components/Image.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,UAAU,QAAsB,OAAO;AAC7D,SAASC,sBAAsB,QAAQ,cAAc;AAuBrD,MAAMC,KAAK,gBAAGH,IAAI,eAChBC,UAAU,CAAa,SAASE,KAAKA,CAAAC,IAAA,EAEnCC,GAA4B,EAC5B;EAAA,IAFA;IAAEC,IAAI;IAAEC,GAAG;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAgB,CAAC,GAAAN,IAAA;EAGlD,MAAMO,WAAW,GAAG;IAClBL,IAAI;IACJC,GAAG;IACHC,QAAQ;IACRC,QAAQ;IACRC;EACF,CAAC;EACD,oBAAOX,KAAA,CAAAa,aAAA,CAACC,WAAW,EAAKF,WAAW,CAAI;AACzC,CAAC,CAAC,CACH;AAUD,OAAO,MAAMG,kBAAkB,GAAG,aAAa;AAE/C,MAAMD,WAAW,GAAGX,sBAAsB,CAAcY,kBAAkB,CAAC;AAE3EX,KAAK,CAACY,WAAW,GAAG,OAAO;AAE3B,eAAeZ,KAAK"}
1
+ {"version":3,"names":["React","memo","forwardRef","requireNativeComponent","Image","_ref","ref","name","sdf","stretchX","stretchY","children","nativeProps","createElement","RCTMGLImage","NATIVE_MODULE_NAME","displayName"],"sourceRoot":"../../../javascript","sources":["components/Image.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,UAAU,QAAsB,OAAO;AAC7D,SAASC,sBAAsB,QAAQ,cAAc;AA+BrD,MAAMC,KAAK,gBAAGH,IAAI,eAChBC,UAAU,CAAa,SAASE,KAAKA,CAAAC,IAAA,EAEnCC,GAA4B,EAC5B;EAAA,IAFA;IAAEC,IAAI;IAAEC,GAAG;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAgB,CAAC,GAAAN,IAAA;EAGlD,MAAMO,WAAW,GAAG;IAClBL,IAAI;IACJC,GAAG;IACHC,QAAQ;IACRC,QAAQ;IACRC;EACF,CAAC;EACD,oBAAOX,KAAA,CAAAa,aAAA,CAACC,WAAW,EAAKF,WAAW,CAAI;AACzC,CAAC,CAAC,CACH;AAUD,OAAO,MAAMG,kBAAkB,GAAG,aAAa;AAE/C,MAAMD,WAAW,GAAGX,sBAAsB,CAAcY,kBAAkB,CAAC;AAE3EX,KAAK,CAACY,WAAW,GAAG,OAAO;AAE3B,eAAeZ,KAAK"}
@@ -37,10 +37,12 @@ class Annotation extends React.Component {
37
37
  return;
38
38
  }
39
39
  const hasCoordChanged = prevProps.coordinates[0] !== this.props.coordinates[0] || prevProps.coordinates[1] !== this.props.coordinates[1];
40
- if (!hasCoordChanged) {
41
- return;
42
- }
43
- if (this.props.animated && this.state.shape) {
40
+ if (prevProps.animated !== this.props.animated || hasCoordChanged && (!this.state.shape || !this.props.animated)) {
41
+ const shape = this._getShapeFromProps(this.props);
42
+ this.setState({
43
+ shape: this.props.animated ? new AnimatedPoint(shape) : shape
44
+ });
45
+ } else if (hasCoordChanged && this.props.animated && this.state.shape) {
44
46
  // flush current animations
45
47
  this.state.shape.stopAnimation();
46
48
  this.state.shape.timing({
@@ -48,11 +50,6 @@ class Annotation extends React.Component {
48
50
  easing: this.props.animationEasingFunction,
49
51
  duration: this.props.animationDuration
50
52
  }).start();
51
- } else if (!this.state.shape || !this.props.animated) {
52
- const shape = this._getShapeFromProps(this.props);
53
- this.setState({
54
- shape: this.props.animated ? new AnimatedPoint(shape) : shape
55
- });
56
53
  }
57
54
  }
58
55
  onPress() {
@@ -1 +1 @@
1
- {"version":3,"names":["React","Easing","PropTypes","SymbolLayer","Animated","AnimatedPoint","Annotation","Component","propTypes","id","string","isRequired","animated","bool","animationDuration","number","animationEasingFunction","func","coordinates","arrayOf","onPress","children","any","style","icon","oneOfType","object","defaultProps","linear","constructor","props","shape","_getShapeFromProps","state","bind","componentDidUpdate","prevProps","Array","isArray","setState","hasCoordChanged","stopAnimation","timing","easing","duration","start","arguments","length","undefined","lng","lat","type","symbolStyle","Object","assign","iconImage","render","createElement","ShapeSource","ref"],"sourceRoot":"../../../../javascript","sources":["components/annotations/Annotation.js"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,MAAM,QAAQ,cAAc;AACrC,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,OAAOC,QAAQ,MAAM,+BAA+B;AACpD,SAASC,aAAa,QAAQ,eAAe;AAE7C,MAAMC,UAAU,SAASN,KAAK,CAACO,SAAS,CAAC;EACvC,OAAOC,SAAS,GAAG;IACjBC,EAAE,EAAEP,SAAS,CAACQ,MAAM,CAACC,UAAU;IAC/BC,QAAQ,EAAEV,SAAS,CAACW,IAAI;IACxBC,iBAAiB,EAAEZ,SAAS,CAACa,MAAM;IACnCC,uBAAuB,EAAEd,SAAS,CAACe,IAAI;IACvCC,WAAW,EAAEhB,SAAS,CAACiB,OAAO,CAACjB,SAAS,CAACa,MAAM,CAAC;IAChDK,O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AAWA,CAAA,EAAG;IAChB,IAAI,CAAC,IAAI,CAACtB,KAAK,CAACN,IAAI,EAAE;MACpB,OAAOwB,SAAS;IAClB;IACA,OAAOK,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAACxB,KAAK,CAACP,KAAK,EAAE;MACzCgC,SAAS,EAAE,IAAI,CAACzB,KAAK,CAACN;IACxB,CAAC,CAAC;EACJ;EAEAgC,MAAMA,CAAA,EAAG;IACP,IAAI,CAAC,IAAI,CAAC1B,KAAK,CAACZ,WAAW,EAAE;MAC3B,OAAO,IAAI;IACb;IAEA,oBACElB,KAAA,CAAAyD,aAAA,CAACrD,QAAQ,CAACsD,WAAW;MACnBjD,EAAE,EAAE,IAAI,CAACqB,KAAK,CAACrB,EAAG;MAClBkD,GAAG,EAAC,QAAQ;MACZvC,OAAO,EAAE,IAAI,CAACA,OAAQ;MACtBW,KAAK,EAAE,IAAI,CAACE,KAAK,CAACF;IAAM,GAEvB,IAAI,CAACqB,WAAW,iBACfpD,KAAA,CAAAyD,aAAA,CAACtD,WAAW;MACVM,EAAE,EAAG,GAAE,IAAI,CAACqB,KAAK,CAACrB,EAAG,SAAS;MAC9Bc,KAAK,EAAE,IAAI,CAAC6B;IAAY,EAE3B,EACA,IAAI,CAACtB,KAAK,CAACT,QAAQ,CACC;EAE3B;AACF;AAEA,eAAef,UAAU"}
1
+ {"version":3,"names":["React","Easing","PropTypes","SymbolLayer","Animated","AnimatedPoint","Annotation","Component","propTypes","id","string","isRequired","animated","bool","animationDuration","number","animationEasingFunction","func","coordinates","arrayOf","onPress","children","any","style","icon","oneOfType","object","defaultProps","linear","constructor","props","shape","_getShapeFromProps","state","bind","componentDidUpdate","prevProps","Array","isArray","setState","hasCoordChanged","stopAnimation","timing","easing","duration","start","arguments","length","undefined","lng","lat","type","symbolStyle","Object","assign","iconImage","render","createElement","ShapeSource","ref"],"sourceRoot":"../../../../javascript","sources":["components/annotations/Annotation.js"],"mappings":"AAAA,OAAOA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,WAAW;MACVM,EAAE,EAAG,GAAE,IAAI,CAACqB,KAAK,CAACrB,EAAG,SAAS;MAC9Bc,KAAK,EAAE,IAAI,CAAC6B;IAAY,EAE3B,EACA,IAAI,CAACtB,KAAK,CAACT,QAAQ,CACC;EAE3B;AACF;AAEA,eAAef,UAAU"}
@@ -1,14 +1,20 @@
1
1
  import React, { ReactElement } from 'react';
2
2
  interface Props {
3
- /** Image name */
3
+ /** ID of the image */
4
4
  name: string;
5
5
  /** Make image an sdf optional - see [SDF icons](https://docs.mapbox.com/help/troubleshooting/using-recolorable-images-in-mapbox-maps/) */
6
6
  sdf?: boolean;
7
- /** stretch along x axis - optional */
7
+ /** An array of two-element arrays, consisting of two numbers that represent, the from position and the to position of areas that can be stretched horizontally. */
8
8
  stretchX?: [number, number][];
9
- /** stretch along y axis - optional */
9
+ /** An array of two-element arrays, consisting of two numbers that represent, the from position and the to position of areas that can be stretched vertically. */
10
10
  stretchY?: [number, number][];
11
- /** Single react native view generating the image */
11
+ /** An array of four numbers, with the first two specifying the left, top
12
+ * corner, and the last two specifying the right, bottom corner. If present, and if the
13
+ * icon uses icon-text-fit, the symbol's text will be fit inside the content box. */
14
+ content?: [number, number, number, number];
15
+ /** Scale factor for the image. */
16
+ scale?: number;
17
+ /** Single react native view rendering the image */
12
18
  children: ReactElement;
13
19
  }
14
20
  interface Ref {
@@ -1 +1 @@
1
- {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../javascript/components/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAoB,YAAY,EAAE,MAAM,OAAO,CAAC;AAG9D,UAAU,KAAK;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,0IAA0I;IAC1I,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,sCAAsC;IACtC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAE9B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAE9B,oDAAoD;IACpD,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED,UAAU,GAAG;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,KAAK,8FAcV,CAAC;AAUF,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAMhD,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../javascript/components/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAoB,YAAY,EAAE,MAAM,OAAO,CAAC;AAG9D,UAAU,KAAK;IACb,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IAEb,0IAA0I;IAC1I,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd,mKAAmK;IACnK,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAE9B,iKAAiK;IACjK,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAE9B;;wFAEoF;IACpF,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE3C,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,mDAAmD;IACnD,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED,UAAU,GAAG;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,KAAK,8FAcV,CAAC;AAUF,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAMhD,eAAe,KAAK,CAAC"}
@@ -10,7 +10,7 @@ export interface Location {
10
10
  /**
11
11
  * Coorinates sent by locationManager
12
12
  */
13
- export interface Coordinates {
13
+ interface Coordinates {
14
14
  /**
15
15
  * The heading (measured in degrees) relative to true north.
16
16
  * Heading is used to describe the direction the device is pointing to (the value of the compass).
@@ -1 +1 @@
1
- {"version":3,"file":"locationManager.d.ts","sourceRoot":"","sources":["../../../../javascript/modules/location/locationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAElB,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAKtB,eAAO,MAAM,0BAA0B,oBAEtC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,cAAM,eAAe;IACnB,UAAU,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC;IAC7C,kBAAkB,EAAE,QAAQ,GAAG,IAAI,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzC,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,gBAAgB,CAAC,EAAE,MAAM,CAAC;;IAgBpB,oBAAoB;IAuB1B,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI;IAalD,cAAc,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI;IAOrD,kBAAkB;IAKlB,qBAAqB,CAAC,QAAQ,EAAE,cAAc;IAY9C,KAAK,CAAC,YAAY,SAAK;IAwBvB,IAAI;IAUJ,kBAAkB,CAAC,eAAe,EAAE,MAAM;IAK1C,oBAAoB,CAAC,iBAAiB,EAAE,OAAO;IAK/C,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAM5B;;OAEG;IACH,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI5D;;;;;;;;;OASG;IACH,wBAAwB,CAAC,aAAa,EAAE,MAAM;CAG/C;;AAED,wBAAqC"}
1
+ {"version":3,"file":"locationManager.d.ts","sourceRoot":"","sources":["../../../../javascript/modules/location/locationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAElB,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAKtB,eAAO,MAAM,0BAA0B,oBAEtC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,UAAU,WAAW;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,cAAM,eAAe;IACnB,UAAU,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC;IAC7C,kBAAkB,EAAE,QAAQ,GAAG,IAAI,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACzC,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,gBAAgB,CAAC,EAAE,MAAM,CAAC;;IAgBpB,oBAAoB;IAuB1B,WAAW,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI;IAalD,cAAc,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI;IAOrD,kBAAkB;IAKlB,qBAAqB,CAAC,QAAQ,EAAE,cAAc;IAY9C,KAAK,CAAC,YAAY,SAAK;IAwBvB,IAAI;IAUJ,kBAAkB,CAAC,eAAe,EAAE,MAAM;IAK1C,oBAAoB,CAAC,iBAAiB,EAAE,OAAO;IAK/C,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAM5B;;OAEG;IACH,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI5D;;;;;;;;;OASG;IACH,wBAAwB,CAAC,aAAa,EAAE,MAAM;CAG/C;;AAED,wBAAqC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rnmapbox/maps",
3
3
  "description": "A Mapbox react native module for creating custom maps",
4
- "version": "10.0.0-beta.72",
4
+ "version": "10.0.0-beta.73",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -1,103 +0,0 @@
1
- package com.mapbox.rctmgl.components.images;
2
-
3
- import android.graphics.drawable.BitmapDrawable;
4
-
5
- import com.facebook.react.bridge.ReactApplicationContext;
6
- import com.facebook.react.bridge.ReadableArray;
7
- import com.facebook.react.bridge.ReadableMap;
8
- import com.facebook.react.bridge.ReadableMapKeySetIterator;
9
- import com.facebook.react.bridge.ReadableType;
10
- import com.facebook.react.common.MapBuilder;
11
- import com.facebook.react.uimanager.ThemedReactContext;
12
- import com.facebook.react.uimanager.ViewGroupManager;
13
- import com.facebook.react.uimanager.annotations.ReactProp;
14
- import com.mapbox.rctmgl.components.AbstractEventEmitter;
15
- import com.mapbox.rctmgl.components.AbstractMapFeature;
16
- import com.mapbox.rctmgl.components.styles.sources.RCTMGLShapeSource;
17
- import com.mapbox.rctmgl.events.constants.EventKeys;
18
- import com.mapbox.rctmgl.utils.ImageEntry;
19
- import com.mapbox.rctmgl.utils.ResourceUtils;
20
-
21
- import java.util.AbstractMap;
22
- import java.util.ArrayList;
23
- import java.util.List;
24
- import java.util.Map;
25
-
26
-
27
- public class RCTMGLImagesManager extends AbstractEventEmitter<RCTMGLImages> {
28
- public static final String REACT_CLASS = "RCTMGLImages";
29
-
30
- private ReactApplicationContext mContext;
31
-
32
- @Override
33
- public String getName() {
34
- return "RCTMGLImages";
35
- }
36
-
37
-
38
- public RCTMGLImagesManager(ReactApplicationContext context) {
39
- super(context);
40
- mContext = context;
41
- }
42
-
43
- @Override
44
- public RCTMGLImages createViewInstance(ThemedReactContext context) {
45
- return new RCTMGLImages(context, this);
46
- }
47
-
48
- @ReactProp(name = "id")
49
- public void setId(RCTMGLImages source, String id) {
50
- source.setID(id);
51
- }
52
-
53
- @ReactProp(name = "images")
54
- public void setImages(RCTMGLImages images, ReadableMap map) {
55
- List<Map.Entry<String, ImageEntry>> imagesList = new ArrayList<>();
56
-
57
- ReadableMapKeySetIterator iterator = map.keySetIterator();
58
- while (iterator.hasNextKey()) {
59
- String imageName = iterator.nextKey();
60
- ImageEntry imageEntry = null;
61
- if (map.getType(imageName) == ReadableType.Map) {
62
- ReadableMap imageMap = map.getMap(imageName);
63
- String uri = imageMap.getString("uri");
64
- boolean hasScale = imageMap.hasKey("scale") && imageMap.getType("scale") == ReadableType.Number;
65
- double scale = hasScale ? imageMap.getDouble("scale") : ImageEntry.defaultScale;
66
- imageEntry = new ImageEntry(uri, scale);
67
- } else {
68
- imageEntry = new ImageEntry(map.getString(imageName));
69
- }
70
- imagesList.add(new AbstractMap.SimpleEntry<String, ImageEntry>(imageName, imageEntry));
71
- }
72
-
73
- images.setImages(imagesList);
74
- }
75
-
76
- @ReactProp(name = "hasOnImageMissing")
77
- public void setHasOnImageMissing(RCTMGLImages images, Boolean value) {
78
- images.setHasOnImageMissing(value);
79
- }
80
-
81
- @ReactProp(name = "nativeImages")
82
- public void setNativeImages(RCTMGLImages images, ReadableArray arr) {
83
- List<Map.Entry<String, BitmapDrawable>> resources = new ArrayList<>();
84
-
85
- for (int i = 0; i < arr.size(); i++) {
86
- String resourceName = arr.getString(i);
87
- BitmapDrawable drawable = (BitmapDrawable) ResourceUtils.getDrawableByName(mContext, resourceName);
88
-
89
- if (drawable != null) {
90
- resources.add(new AbstractMap.SimpleEntry<String, BitmapDrawable>(resourceName, drawable));
91
- }
92
- }
93
-
94
- images.setNativeImages(resources);
95
- }
96
-
97
- @Override
98
- public Map<String, String> customEvents() {
99
- return MapBuilder.<String, String>builder()
100
- .put(EventKeys.IMAGES_MISSING, "onImageMissing")
101
- .build();
102
- }
103
- }