Skip to content

Commit

Permalink
Fix[iOS]: get visit bounds (#3664)
Browse files Browse the repository at this point in the history
  • Loading branch information
pranshuchittora authored Oct 27, 2024
1 parent a64c3ba commit 51e5294
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ios/RNMBX/RNMBXMapViewManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ extension RNMBXMapViewManager {

@objc public static func getVisibleBounds(
_ view: RNMBXMapView,
resolver: @escaping RCTPromiseResolveBlock) {
resolver(["visibleBounds": view.mapboxMap.coordinateBounds(for: view.bounds).toArray()])
resolver: @escaping RCTPromiseResolveBlock,
rejecter: @escaping RCTPromiseRejectBlock) {
view.withMapboxMap { map in
resolver(["visibleBounds": map.coordinateBounds(for: view.bounds).toArray()])
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion ios/RNMBX/RNMBXMapViewModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (void)withMapView:(nonnull NSNumber*)viewRef block:(void (^)(RNMBXMapView *))b

RCT_EXPORT_METHOD(getVisibleBounds:(nonnull NSNumber*)viewRef resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
[self withMapView:viewRef block:^(RNMBXMapView *view) {
[RNMBXMapViewManager getVisibleBounds:view resolver:resolve];
[RNMBXMapViewManager getVisibleBounds:view resolver:resolve rejecter:reject];
} reject:reject methodName:@"getVisibleBounds"];
}

Expand Down

0 comments on commit 51e5294

Please sign in to comment.