@maplibre/maplibre-react-native 11.3.3 → 11.3.5

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.
@@ -262,7 +262,7 @@ open class MLRNMapViewManager(
262
262
  * tearing down the views in onDropViewInstance.
263
263
  */
264
264
  fun disposeNativeMapView() {
265
- val mapView = mViewManager.getByReactTag(reactTag)
265
+ val mapView = mViewManager.getByReactTag(getReactTag())
266
266
 
267
267
  if (mapView != null) {
268
268
  UiThreadUtil.runOnUiThread {
@@ -49,6 +49,10 @@ typedef NS_ENUM(NSInteger, MLRNImageQueueOperationState) {
49
49
  }
50
50
  }
51
51
 
52
+ - (BOOL)isAsynchronous {
53
+ return YES;
54
+ }
55
+
52
56
  - (void)setCancellationBlock:(dispatch_block_t)block {
53
57
  _cancellationBlock = block;
54
58
  }
@@ -100,12 +104,22 @@ typedef NS_ENUM(NSInteger, MLRNImageQueueOperationState) {
100
104
  if (self.state == IOState_CancelledDoNotExecute) {
101
105
  return;
102
106
  }
103
- __weak MLRNImageQueueOperation *weakSelf = self;
107
+
108
+ MLRNImageQueueOperationState prevState = [self setState:IOState_Executing only:IOState_Initial];
109
+ if (prevState != IOState_Initial) {
110
+ return;
111
+ }
112
+
113
+ MLRNImageQueueOperation *strongSelf = self;
104
114
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
105
- [weakSelf
106
- setCancellationBlock:[weakSelf.imageLoader loadImageWithURLRequest:weakSelf.urlRequest
115
+ if (strongSelf.isCancelled) {
116
+ return;
117
+ }
118
+
119
+ [strongSelf
120
+ setCancellationBlock:[strongSelf.imageLoader loadImageWithURLRequest:strongSelf.urlRequest
107
121
  size:CGSizeZero
108
- scale:weakSelf.scale
122
+ scale:strongSelf.scale
109
123
  clipped:YES
110
124
  resizeMode:RCTResizeModeStretch
111
125
  progressBlock:^(int64_t progress, int64_t total) {
@@ -115,16 +129,17 @@ typedef NS_ENUM(NSInteger, MLRNImageQueueOperationState) {
115
129
  // No-op
116
130
  }
117
131
  completionBlock:^void(NSError *error, UIImage *image) {
118
- if (image && weakSelf.sdf) {
132
+ if (image && strongSelf.sdf) {
119
133
  image = [image
120
134
  imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
121
135
  }
122
- weakSelf.completionHandler(error, image);
123
- [weakSelf setState:IOState_Finished except:IOState_Finished];
136
+ if (strongSelf.completionHandler) {
137
+ strongSelf.completionHandler(error, image);
138
+ }
139
+ [strongSelf setState:IOState_Finished only:IOState_Executing];
124
140
  }]];
125
- if ([weakSelf setState:IOState_Executing
126
- only:IOState_Initial] == IOState_CancelledDoNotExecute) {
127
- [weakSelf callCancellationBlock];
141
+ if (strongSelf.isCancelled) {
142
+ [strongSelf callCancellationBlock];
128
143
  }
129
144
  });
130
145
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maplibre/maplibre-react-native",
3
3
  "description": "React Native library for creating maps with MapLibre Native for Android & iOS",
4
- "version": "11.3.3",
4
+ "version": "11.3.5",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": true