Skip to content

Commit

Permalink
fix(ios): new arch and nonnull fixes (#3061)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas authored Sep 19, 2023
1 parent f5349a1 commit 7c9e852
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions ios/RCTMGL-v10/MBXMapViewModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (dispatch_queue_t)methodQueue
return RCTGetUIManagerQueue();
}

- (void)withMapView:(NSNumber*)viewRef block:(void (^)(MBXMapView *))block reject:(RCTPromiseRejectBlock)reject methodName:(NSString *)methodName
- (void)withMapView:(nonnull NSNumber*)viewRef block:(void (^)(MBXMapView *))block reject:(RCTPromiseRejectBlock)reject methodName:(NSString *)methodName
{
// void (^upperBlock)(void) = ^{
#ifdef RCT_NEW_ARCH_ENABLED
Expand Down Expand Up @@ -62,28 +62,28 @@ - (void)withMapView:(NSNumber*)viewRef block:(void (^)(MBXMapView *))block rejec
}


RCT_EXPORT_METHOD(takeSnap:(NSNumber*)viewRef writeToDisk:(BOOL)writeToDisk resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
RCT_EXPORT_METHOD(takeSnap:(nonnull NSNumber*)viewRef writeToDisk:(BOOL)writeToDisk resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
{
[self withMapView:viewRef block:^(MBXMapView *view) {
[MBXMapViewManager takeSnap:view writeToDisk:writeToDisk resolver:resolve];
} reject:reject methodName:@"takeSnap"];
}

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


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


RCT_EXPORT_METHOD(getCoordinateFromView:(NSNumber*)viewRef atPoint:(NSArray *)atPoint resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
RCT_EXPORT_METHOD(getCoordinateFromView:(nonnull NSNumber*)viewRef atPoint:(NSArray *)atPoint resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
[self withMapView:viewRef block:^(MBXMapView *view) {
NSNumber* a = [atPoint objectAtIndex:0];
NSNumber* b = [atPoint objectAtIndex:1];
Expand All @@ -100,14 +100,14 @@ - (void)withMapView:(NSNumber*)viewRef block:(void (^)(MBXMapView *))block rejec
}


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


RCT_EXPORT_METHOD(getZoom:(NSNumber*)viewRef resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
RCT_EXPORT_METHOD(getZoom:(nonnull NSNumber*)viewRef resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
[self withMapView:viewRef block:^(MBXMapView *view) {
[MBXMapViewManager getZoom:view resolver:resolve rejecter:reject];
} reject:reject methodName:@"getZoom"];
Expand Down
2 changes: 1 addition & 1 deletion ios/RCTMGL-v10/RCTMGLMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ open class RCTMGLMapView : MapView {
super.removeReactSubview(subview)
}

public required init(frame:CGRect, eventDispatcher: RCTEventDispatcherProtocol) {
@objc public required init(frame:CGRect, eventDispatcher: RCTEventDispatcherProtocol) {
#if RNMBX_11
self.eventDispatcher = eventDispatcher
super.init(frame: frame, mapInitOptions: MapInitOptions())
Expand Down

0 comments on commit 7c9e852

Please sign in to comment.