File tree Expand file tree Collapse file tree 4 files changed +22
-14
lines changed
Expand file tree Collapse file tree 4 files changed +22
-14
lines changed Original file line number Diff line number Diff line change 4242@property (nonatomic , assign ) BOOL showsMyLocationButton;
4343@property (nonatomic , assign ) BOOL showsIndoorLevelPicker;
4444
45- - (void )didFinishTileRendering ;
45+ - (void )didPrepareMap ;
4646- (BOOL )didTapMarker : (GMSMarker *)marker ;
4747- (void )didTapPolyline : (GMSPolyline *)polyline ;
4848- (void )didTapPolygon : (GMSPolygon *)polygon ;
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ - (void)setRegion:(MKCoordinateRegion)region {
155155 self.camera = [AIRGoogleMap makeGMSCameraPositionFromMap: self andMKCoordinateRegion: region];
156156}
157157
158- - (void )didFinishTileRendering {
158+ - (void )didPrepareMap {
159159 if (self.onMapReady ) self.onMapReady (@{});
160160}
161161
Original file line number Diff line number Diff line change 3232
3333
3434@interface AIRGoogleMapManager () <GMSMapViewDelegate>
35-
35+ {
36+ BOOL didCallOnMapReady;
37+ }
38+
3639@end
3740
3841@implementation AIRGoogleMapManager
@@ -263,13 +266,12 @@ - (NSDictionary *)constantsToExport {
263266 return @{ @" legalNotice" : [GMSServices openSourceLicenseInfo ] };
264267}
265268
266- + (BOOL )requiresMainQueueSetup {
267- return YES ;
268- }
269-
270- - (void )mapViewDidFinishTileRendering : (GMSMapView *)mapView {
271- AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
272- [googleMapView didFinishTileRendering ];
269+ - (void )mapViewDidStartTileRendering : (GMSMapView *)mapView {
270+ if (didCallOnMapReady) return ;
271+ didCallOnMapReady = YES ;
272+
273+ AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
274+ [googleMapView didPrepareMap ];
273275}
274276
275277- (BOOL )mapView : (GMSMapView *)mapView didTapMarker : (GMSMarker *)marker {
Original file line number Diff line number Diff line change @@ -36,7 +36,10 @@ @interface AIRMapManager() <MKMapViewDelegate>
3636@end
3737
3838@implementation AIRMapManager
39-
39+ {
40+ BOOL didCallOnMapReady;
41+ }
42+
4043RCT_EXPORT_MODULE ()
4144
4245- (UIView *)view
@@ -708,6 +711,12 @@ - (void)mapView:(AIRMap *)mapView regionDidChangeAnimated:(__unused BOOL)animate
708711
709712- (void )mapViewWillStartRenderingMap : (AIRMap *)mapView
710713{
714+ if (!didCallOnMapReady)
715+ {
716+ didCallOnMapReady = YES ;
717+ mapView.onMapReady (@{});
718+ }
719+
711720 mapView.hasStartedRendering = YES ;
712721 [mapView beginLoading ];
713722 [self _emitRegionChangeEvent: mapView continuous: NO ];
@@ -716,9 +725,6 @@ - (void)mapViewWillStartRenderingMap:(AIRMap *)mapView
716725- (void )mapViewDidFinishRenderingMap : (AIRMap *)mapView fullyRendered : (BOOL )fullyRendered
717726{
718727 [mapView finishLoading ];
719- [mapView cacheViewIfNeeded ];
720-
721- mapView.onMapReady (@{});
722728}
723729
724730#pragma mark Private
You can’t perform that action at this time.
0 commit comments