@lugg/maps 0.2.0-alpha.17 → 0.2.0-alpha.18

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.
@@ -146,10 +146,7 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
146
146
  view.onCreate(null)
147
147
  view.onResume()
148
148
  view.getMapAsync(this)
149
- mapWrapperView?.addView(
150
- view,
151
- LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
152
- )
149
+ mapWrapperView?.addView(view)
153
150
  }
154
151
  }
155
152
 
@@ -241,9 +238,7 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
241
238
  }
242
239
 
243
240
  if (markerView.hasCustomView) {
244
- // Recreate marker with custom view
245
- markerView.marker?.remove()
246
- addMarkerViewToMap(markerView)
241
+ markerView.updateIcon { addMarkerViewToMap(markerView) }
247
242
  } else {
248
243
  syncMarkerView(markerView)
249
244
  }
@@ -276,9 +271,6 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
276
271
  snippet = markerView.description
277
272
  setAnchor(markerView.anchorX, markerView.anchorY)
278
273
  zIndex = markerView.zIndex
279
- if (!markerView.hasCustomView) {
280
- iconView = null
281
- }
282
274
  }
283
275
  }
284
276
 
@@ -296,24 +288,18 @@ class LuggGoogleMapView(private val reactContext: ThemedReactContext) :
296
288
  }
297
289
 
298
290
  val position = LatLng(markerView.latitude, markerView.longitude)
299
- val iconView = markerView.iconView
300
-
301
- (iconView.parent as? ViewGroup)?.removeView(iconView)
302
291
 
303
292
  val options = AdvancedMarkerOptions()
304
293
  .position(position)
305
294
  .title(markerView.title)
306
295
  .snippet(markerView.description)
307
296
 
308
- if (markerView.hasCustomView) {
309
- options.iconView(iconView)
310
- }
311
-
312
297
  val marker = map.addMarker(options) as AdvancedMarker
313
298
  marker.setAnchor(markerView.anchorX, markerView.anchorY)
314
299
  marker.zIndex = markerView.zIndex
315
300
 
316
301
  markerView.marker = marker
302
+ markerView.applyIconToMarker()
317
303
  }
318
304
 
319
305
  // endregion
@@ -17,23 +17,4 @@ class LuggMapWrapperView(context: ThemedReactContext) : ReactViewGroup(context)
17
17
  it.layout(0, 0, width, height)
18
18
  }
19
19
  }
20
-
21
- override fun onLayout(
22
- changed: Boolean,
23
- left: Int,
24
- top: Int,
25
- right: Int,
26
- bottom: Int
27
- ) {
28
- super.onLayout(changed, left, top, right, bottom)
29
- val w = right - left
30
- val h = bottom - top
31
- getChildAt(0)?.let {
32
- it.measure(
33
- MeasureSpec.makeMeasureSpec(w, MeasureSpec.EXACTLY),
34
- MeasureSpec.makeMeasureSpec(h, MeasureSpec.EXACTLY)
35
- )
36
- it.layout(0, 0, w, h)
37
- }
38
- }
39
20
  }
@@ -1,10 +1,16 @@
1
1
  package com.luggmaps
2
2
 
3
3
  import android.content.Context
4
+ import android.graphics.Bitmap
5
+ import android.graphics.Canvas
4
6
  import android.view.View
7
+ import android.view.ViewGroup
8
+ import androidx.core.graphics.createBitmap
5
9
  import androidx.core.view.isNotEmpty
6
10
  import com.facebook.react.views.view.ReactViewGroup
7
11
  import com.google.android.gms.maps.model.AdvancedMarker
12
+ import com.google.android.gms.maps.model.BitmapDescriptor
13
+ import com.google.android.gms.maps.model.BitmapDescriptorFactory
8
14
 
9
15
  interface LuggMarkerViewDelegate {
10
16
  fun markerViewDidUpdate(markerView: LuggMarkerView)
@@ -36,23 +42,91 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
36
42
  var zIndex: Float = 0f
37
43
  private set
38
44
 
45
+ var rasterize: Boolean = true
46
+ private set
47
+
39
48
  var didLayout: Boolean = false
40
49
  private set
41
50
 
51
+ var isPendingUpdate: Boolean = false
52
+
42
53
  val hasCustomView: Boolean
43
54
  get() = iconView.isNotEmpty()
44
55
 
45
- val iconView: ReactViewGroup = object : ReactViewGroup(context) {
46
- override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
47
- var maxWidth = 0
48
- var maxHeight = 0
49
- for (i in 0 until childCount) {
50
- val child = getChildAt(i)
51
- if (child.width > maxWidth) maxWidth = child.width
52
- if (child.height > maxHeight) maxHeight = child.height
56
+ val iconView: ReactViewGroup = ReactViewGroup(context)
57
+
58
+ private fun measureIconViewBounds(): Pair<Int, Int> {
59
+ var maxWidth = 0
60
+ var maxHeight = 0
61
+ for (i in 0 until iconView.childCount) {
62
+ val child = iconView.getChildAt(i)
63
+ val childRight = child.left + child.width
64
+ val childBottom = child.top + child.height
65
+ if (childRight > maxWidth) maxWidth = childRight
66
+ if (childBottom > maxHeight) maxHeight = childBottom
67
+ }
68
+ return Pair(maxWidth, maxHeight)
69
+ }
70
+
71
+ private fun createIconBitmap(): BitmapDescriptor? {
72
+ val (width, height) = measureIconViewBounds()
73
+ if (width <= 0 || height <= 0) return null
74
+
75
+ val bitmap = createBitmap(width, height)
76
+ val canvas = Canvas(bitmap)
77
+ iconView.draw(canvas)
78
+ return BitmapDescriptorFactory.fromBitmap(bitmap)
79
+ }
80
+
81
+ private fun createIconViewWrapper(): View {
82
+ val (width, height) = measureIconViewBounds()
83
+
84
+ (iconView.parent as? ViewGroup)?.removeView(iconView)
85
+
86
+ return object : ReactViewGroup(context) {
87
+ init {
88
+ addView(iconView)
53
89
  }
54
90
 
55
- setMeasuredDimension(maxWidth, maxHeight)
91
+ override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
92
+ setMeasuredDimension(width, height)
93
+ }
94
+ }
95
+ }
96
+
97
+ fun applyIconToMarker() {
98
+ val m = marker ?: return
99
+ if (!hasCustomView) return
100
+
101
+ if (rasterize) {
102
+ m.iconView = null
103
+ createIconBitmap()?.let { m.setIcon(it) }
104
+ } else {
105
+ m.iconView = createIconViewWrapper()
106
+ }
107
+ }
108
+
109
+ fun updateIcon(onAddMarker: () -> Unit) {
110
+ if (!hasCustomView) return
111
+ if (isPendingUpdate) return
112
+ isPendingUpdate = true
113
+
114
+ if (rasterize) {
115
+ post {
116
+ isPendingUpdate = false
117
+ if (marker == null) {
118
+ onAddMarker()
119
+ } else {
120
+ applyIconToMarker()
121
+ }
122
+ }
123
+ } else {
124
+ marker?.remove()
125
+ marker = null
126
+ post {
127
+ isPendingUpdate = false
128
+ onAddMarker()
129
+ }
56
130
  }
57
131
  }
58
132
 
@@ -92,6 +166,7 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
92
166
  bottom: Int
93
167
  ) {
94
168
  super.onLayout(changed, left, top, right, bottom)
169
+
95
170
  if (changed && !didLayout) {
96
171
  didLayout = true
97
172
  delegate?.markerViewDidLayout(this)
@@ -120,6 +195,10 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
120
195
  this.zIndex = zIndex
121
196
  }
122
197
 
198
+ fun setRasterize(rasterize: Boolean) {
199
+ this.rasterize = rasterize
200
+ }
201
+
123
202
  fun setName(name: String?) {
124
203
  this.name = name
125
204
  }
@@ -133,8 +212,4 @@ class LuggMarkerView(context: Context) : ReactViewGroup(context) {
133
212
  delegate = null
134
213
  iconView.removeAllViews()
135
214
  }
136
-
137
- companion object {
138
- private const val TAG = "Lugg"
139
- }
140
215
  }
@@ -69,6 +69,11 @@ class LuggMarkerViewManager :
69
69
  view.setZIndex(zIndex)
70
70
  }
71
71
 
72
+ @ReactProp(name = "rasterize", defaultBoolean = true)
73
+ override fun setRasterize(view: LuggMarkerView, value: Boolean) {
74
+ view.setRasterize(value)
75
+ }
76
+
72
77
  companion object {
73
78
  const val NAME = "LuggMarkerView"
74
79
  }
@@ -267,7 +267,13 @@ using namespace luggmaps::events;
267
267
  UIView *iconView = markerView.iconView;
268
268
  CGRect frame = iconView.frame;
269
269
  if (frame.size.width > 0 && frame.size.height > 0) {
270
- annotationView.frame = frame;
270
+ if (markerView.rasterize) {
271
+ annotationView.image = [markerView createIconImage];
272
+ annotationView.frame =
273
+ CGRectMake(0, 0, frame.size.width, frame.size.height);
274
+ } else {
275
+ annotationView.frame = frame;
276
+ }
271
277
 
272
278
  CGPoint anchor = markerView.anchor;
273
279
  annotationView.centerOffset =
@@ -478,15 +484,19 @@ using namespace luggmaps::events;
478
484
  annotationView.zPriority = markerView.zIndex;
479
485
 
480
486
  UIView *iconView = markerView.iconView;
481
- [iconView removeFromSuperview];
482
- [annotationView addSubview:iconView];
483
-
484
- // Set frame and centerOffset based on iconView
485
487
  CGRect frame = iconView.frame;
488
+
489
+ if (markerView.rasterize) {
490
+ annotationView.image = [markerView createIconImage];
491
+ } else {
492
+ [iconView removeFromSuperview];
493
+ [annotationView addSubview:iconView];
494
+ iconView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
495
+ }
496
+
486
497
  if (frame.size.width > 0 && frame.size.height > 0) {
487
498
  annotationView.frame =
488
499
  CGRectMake(0, 0, frame.size.width, frame.size.height);
489
- iconView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
490
500
 
491
501
  CGPoint anchor = markerView.anchor;
492
502
  annotationView.centerOffset =
@@ -244,14 +244,20 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
244
244
  marker.snippet = markerView.markerDescription;
245
245
  marker.zIndex = (int)markerView.zIndex;
246
246
  if (markerView.hasCustomView) {
247
- UIView *iconView = markerView.iconView;
248
- if (marker.iconView != iconView) {
249
- [iconView removeFromSuperview];
250
- marker.iconView = iconView;
247
+ if (markerView.rasterize) {
248
+ marker.iconView = nil;
249
+ marker.icon = [markerView createIconImage];
250
+ } else {
251
+ UIView *iconView = markerView.iconView;
252
+ if (marker.iconView != iconView) {
253
+ [iconView removeFromSuperview];
254
+ marker.iconView = iconView;
255
+ }
251
256
  }
252
257
  marker.groundAnchor = markerView.anchor;
253
258
  } else {
254
259
  marker.iconView = nil;
260
+ marker.icon = nil;
255
261
  marker.groundAnchor = CGPointMake(0.5, 1);
256
262
  }
257
263
  }
@@ -273,16 +279,19 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
273
279
  return;
274
280
  }
275
281
 
276
- UIView *iconView = markerView.iconView;
277
- [iconView removeFromSuperview];
278
-
279
282
  GMSAdvancedMarker *marker = [[GMSAdvancedMarker alloc] init];
280
283
  marker.position = markerView.coordinate;
281
284
  marker.title = markerView.title;
282
285
  marker.snippet = markerView.markerDescription;
283
286
 
284
287
  if (markerView.hasCustomView) {
285
- marker.iconView = iconView;
288
+ if (markerView.rasterize) {
289
+ marker.icon = [markerView createIconImage];
290
+ } else {
291
+ UIView *iconView = markerView.iconView;
292
+ [iconView removeFromSuperview];
293
+ marker.iconView = iconView;
294
+ }
286
295
  marker.groundAnchor = markerView.anchor;
287
296
  }
288
297
 
@@ -20,12 +20,15 @@ NS_ASSUME_NONNULL_BEGIN
20
20
  @property(nonatomic, readonly, nullable) NSString *markerDescription;
21
21
  @property(nonatomic, readonly) CGPoint anchor;
22
22
  @property(nonatomic, readonly) NSInteger zIndex;
23
+ @property(nonatomic, readonly) BOOL rasterize;
23
24
  @property(nonatomic, readonly) BOOL hasCustomView;
24
25
  @property(nonatomic, readonly) BOOL didLayout;
25
26
  @property(nonatomic, readonly) UIView *iconView;
26
27
  @property(nonatomic, weak, nullable) id<LuggMarkerViewDelegate> delegate;
27
28
  @property(nonatomic, strong, nullable) NSObject *marker;
28
29
 
30
+ - (nullable UIImage *)createIconImage;
31
+
29
32
  @end
30
33
 
31
34
  NS_ASSUME_NONNULL_END
@@ -19,6 +19,7 @@ using namespace facebook::react;
19
19
  NSString *_markerDescription;
20
20
  CGPoint _anchor;
21
21
  NSInteger _zIndex;
22
+ BOOL _rasterize;
22
23
  BOOL _didLayout;
23
24
  UIView *_iconView;
24
25
  }
@@ -37,6 +38,7 @@ using namespace facebook::react;
37
38
  _coordinate = CLLocationCoordinate2DMake(0, 0);
38
39
  _anchor = CGPointMake(0.5, 1.0);
39
40
  _zIndex = 0;
41
+ _rasterize = YES;
40
42
  _didLayout = NO;
41
43
 
42
44
  _iconView = [[UIView alloc] init];
@@ -63,6 +65,7 @@ using namespace facebook::react;
63
65
  [NSString stringWithUTF8String:newViewProps.description.c_str()];
64
66
  _anchor = CGPointMake(newViewProps.anchor.x, newViewProps.anchor.y);
65
67
  _zIndex = newViewProps.zIndex.value_or(0);
68
+ _rasterize = newViewProps.rasterize;
66
69
  }
67
70
 
68
71
  - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
@@ -138,6 +141,10 @@ using namespace facebook::react;
138
141
  return _zIndex;
139
142
  }
140
143
 
144
+ - (BOOL)rasterize {
145
+ return _rasterize;
146
+ }
147
+
141
148
  - (BOOL)hasCustomView {
142
149
  return _iconView.subviews.count > 0;
143
150
  }
@@ -150,6 +157,23 @@ using namespace facebook::react;
150
157
  return _iconView;
151
158
  }
152
159
 
160
+ - (UIImage *)createIconImage {
161
+ CGSize size = _iconView.bounds.size;
162
+ if (size.width <= 0 || size.height <= 0) {
163
+ return nil;
164
+ }
165
+
166
+ UIGraphicsImageRendererFormat *format =
167
+ [UIGraphicsImageRendererFormat defaultFormat];
168
+ format.scale = [UIScreen mainScreen].scale;
169
+ UIGraphicsImageRenderer *renderer =
170
+ [[UIGraphicsImageRenderer alloc] initWithSize:size format:format];
171
+
172
+ return [renderer imageWithActions:^(UIGraphicsImageRendererContext *context) {
173
+ [self->_iconView.layer renderInContext:context.CGContext];
174
+ }];
175
+ }
176
+
153
177
  - (void)prepareForRecycle {
154
178
  [super prepareForRecycle];
155
179
  _didLayout = NO;
@@ -13,6 +13,7 @@ export class Marker extends React.Component {
13
13
  description,
14
14
  anchor,
15
15
  zIndex,
16
+ rasterize = true,
16
17
  children
17
18
  } = this.props;
18
19
  return /*#__PURE__*/_jsx(LuggMarkerViewNativeComponent, {
@@ -24,6 +25,7 @@ export class Marker extends React.Component {
24
25
  title: title,
25
26
  description: description,
26
27
  anchor: anchor,
28
+ rasterize: rasterize,
27
29
  children: children
28
30
  });
29
31
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","StyleSheet","LuggMarkerViewNativeComponent","jsx","_jsx","Marker","Component","render","name","coordinate","title","description","anchor","zIndex","children","props","style","styles","marker","create","position","pointerEvents"],"sourceRoot":"../../../src","sources":["components/Marker.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,6BAA6B,MAAM,yCAAyC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAkCpF,OAAO,MAAMC,MAAM,SAASL,KAAK,CAACM,SAAS,CAAc;EACvDC,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC,IAAI;MAAEC,UAAU;MAAEC,KAAK;MAAEC,WAAW;MAAEC,MAAM;MAAEC,MAAM;MAAEC;IAAS,CAAC,GACtE,IAAI,CAACC,KAAK;IAEZ,oBACEX,IAAA,CAACF,6BAA6B;MAC5Bc,KAAK,EAAE,CAAC;QAAEH;MAAO,CAAC,EAAEI,MAAM,CAACC,MAAM,CAAE;MACnCV,IAAI,EAAEA,IAAK;MACXC,UAAU,EAAEA,UAAW;MACvBC,KAAK,EAAEA,KAAM;MACbC,WAAW,EAAEA,WAAY;MACzBC,MAAM,EAAEA,MAAO;MAAAE,QAAA,EAEdA;IAAQ,CACoB,CAAC;EAEpC;AACF;AAEA,MAAMG,MAAM,GAAGhB,UAAU,CAACkB,MAAM,CAAC;EAC/BD,MAAM,EAAE;IACNE,QAAQ,EAAE,UAAU;IACpBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","StyleSheet","LuggMarkerViewNativeComponent","jsx","_jsx","Marker","Component","render","name","coordinate","title","description","anchor","zIndex","rasterize","children","props","style","styles","marker","create","position","pointerEvents"],"sourceRoot":"../../../src","sources":["components/Marker.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,cAAc;AACzC,OAAOC,6BAA6B,MAAM,yCAAyC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAwCpF,OAAO,MAAMC,MAAM,SAASL,KAAK,CAACM,SAAS,CAAc;EACvDC,MAAMA,CAAA,EAAG;IACP,MAAM;MACJC,IAAI;MACJC,UAAU;MACVC,KAAK;MACLC,WAAW;MACXC,MAAM;MACNC,MAAM;MACNC,SAAS,GAAG,IAAI;MAChBC;IACF,CAAC,GAAG,IAAI,CAACC,KAAK;IAEd,oBACEZ,IAAA,CAACF,6BAA6B;MAC5Be,KAAK,EAAE,CAAC;QAAEJ;MAAO,CAAC,EAAEK,MAAM,CAACC,MAAM,CAAE;MACnCX,IAAI,EAAEA,IAAK;MACXC,UAAU,EAAEA,UAAW;MACvBC,KAAK,EAAEA,KAAM;MACbC,WAAW,EAAEA,WAAY;MACzBC,MAAM,EAAEA,MAAO;MACfE,SAAS,EAAEA,SAAU;MAAAC,QAAA,EAEpBA;IAAQ,CACoB,CAAC;EAEpC;AACF;AAEA,MAAMG,MAAM,GAAGjB,UAAU,CAACmB,MAAM,CAAC;EAC/BD,MAAM,EAAE;IACNE,QAAQ,EAAE,UAAU;IACpBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,6 +1,9 @@
1
1
  import { codegenNativeComponent } from 'react-native';
2
2
  import type { ViewProps, HostComponent } from 'react-native';
3
- import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type {
4
+ Double,
5
+ WithDefault,
6
+ } from 'react-native/Libraries/Types/CodegenTypes';
4
7
 
5
8
  export interface Coordinate {
6
9
  latitude: Double;
@@ -18,6 +21,7 @@ export interface NativeProps extends ViewProps {
18
21
  title?: string;
19
22
  description?: string;
20
23
  anchor?: Point;
24
+ rasterize?: WithDefault<boolean, true>;
21
25
  }
22
26
 
23
27
  export default codegenNativeComponent<NativeProps>(
@@ -26,6 +26,12 @@ export interface MarkerProps {
26
26
  * Z-index for marker ordering. Higher values render on top.
27
27
  */
28
28
  zIndex?: number;
29
+ /**
30
+ * Rasterize custom marker view to bitmap for better performance.
31
+ * Set to false if you need live view updates (e.g., animations).
32
+ * @default true
33
+ */
34
+ rasterize?: boolean;
29
35
  /**
30
36
  * Custom marker view
31
37
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../../../src/components/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,qBAAa,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACtD,MAAM;CAiBP"}
1
+ {"version":3,"file":"Marker.d.ts","sourceRoot":"","sources":["../../../../src/components/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,qBAAa,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC;IACtD,MAAM;CA0BP"}
@@ -1,5 +1,5 @@
1
1
  import type { ViewProps, HostComponent } from 'react-native';
2
- import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
2
+ import type { Double, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
3
3
  export interface Coordinate {
4
4
  latitude: Double;
5
5
  longitude: Double;
@@ -14,6 +14,7 @@ export interface NativeProps extends ViewProps {
14
14
  title?: string;
15
15
  description?: string;
16
16
  anchor?: Point;
17
+ rasterize?: WithDefault<boolean, true>;
17
18
  }
18
19
  declare const _default: HostComponent<NativeProps>;
19
20
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"LuggMarkerViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/fabric/LuggMarkerViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
1
+ {"version":3,"file":"LuggMarkerViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/fabric/LuggMarkerViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACZ,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,SAAS,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;CACxC;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lugg/maps",
3
- "version": "0.2.0-alpha.17",
3
+ "version": "0.2.0-alpha.18",
4
4
  "description": "Universal maps for React Native.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -29,6 +29,12 @@ export interface MarkerProps {
29
29
  * Z-index for marker ordering. Higher values render on top.
30
30
  */
31
31
  zIndex?: number;
32
+ /**
33
+ * Rasterize custom marker view to bitmap for better performance.
34
+ * Set to false if you need live view updates (e.g., animations).
35
+ * @default true
36
+ */
37
+ rasterize?: boolean;
32
38
  /**
33
39
  * Custom marker view
34
40
  */
@@ -37,8 +43,16 @@ export interface MarkerProps {
37
43
 
38
44
  export class Marker extends React.Component<MarkerProps> {
39
45
  render() {
40
- const { name, coordinate, title, description, anchor, zIndex, children } =
41
- this.props;
46
+ const {
47
+ name,
48
+ coordinate,
49
+ title,
50
+ description,
51
+ anchor,
52
+ zIndex,
53
+ rasterize = true,
54
+ children,
55
+ } = this.props;
42
56
 
43
57
  return (
44
58
  <LuggMarkerViewNativeComponent
@@ -48,6 +62,7 @@ export class Marker extends React.Component<MarkerProps> {
48
62
  title={title}
49
63
  description={description}
50
64
  anchor={anchor}
65
+ rasterize={rasterize}
51
66
  >
52
67
  {children}
53
68
  </LuggMarkerViewNativeComponent>
@@ -1,6 +1,9 @@
1
1
  import { codegenNativeComponent } from 'react-native';
2
2
  import type { ViewProps, HostComponent } from 'react-native';
3
- import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type {
4
+ Double,
5
+ WithDefault,
6
+ } from 'react-native/Libraries/Types/CodegenTypes';
4
7
 
5
8
  export interface Coordinate {
6
9
  latitude: Double;
@@ -18,6 +21,7 @@ export interface NativeProps extends ViewProps {
18
21
  title?: string;
19
22
  description?: string;
20
23
  anchor?: Point;
24
+ rasterize?: WithDefault<boolean, true>;
21
25
  }
22
26
 
23
27
  export default codegenNativeComponent<NativeProps>(