Skip to content

Instantly share code, notes, and snippets.

@madjam002
Created March 26, 2015 22:39
Show Gist options
  • Save madjam002/5f0dd570f8b20ce9e124 to your computer and use it in GitHub Desktop.
Save madjam002/5f0dd570f8b20ce9e124 to your computer and use it in GitHub Desktop.
#import "RCTViewManager.h"
#import "MapboxGL.h"
@interface MapBoxViewManager : RCTViewManager
@end
@implementation MapBoxViewManager
- (UIView *)view
{
MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)
accessToken:@"token"];
return mapView;
}
@end
@nicklockwood
Copy link

Yeah, - (UIView *)view should definitely always be called on the main thread. Are you certain that it isn't being? If you put a breakpoint in that method, what thread is it being hit on?

@madjam002
Copy link
Author

Thread 1, so I think it's something to do with Mapbox internally creating threads for rendering the map, but surely that shouldn't conflict with react-native? I thought that as long as initWithFrame is called on the main thread, all should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment