Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed onMapReady event on iOS to resemble onMapReady on Android #1797

Merged

Conversation

danielgindi
Copy link
Contributor

(Closes #1793)

Also: Closes #1776, Closes #1696, Closes #1680, Closes #1605)
Probably closes more issues related to iOS, panning and scrolling.


The issue is that on Android, the onMapReady comes from the native onMapReady event, which occurs when Google Play Services first provides a Google Maps view.

But on iOS - it happened whenever rendering has finished - which is a completely different interpretation, and misses the point of just doing the initial stuff like initialRegion/region.

@@ -716,9 +725,6 @@ - (void)mapViewWillStartRenderingMap:(AIRMap *)mapView
- (void)mapViewDidFinishRenderingMap:(AIRMap *)mapView fullyRendered:(BOOL)fullyRendered
{
[mapView finishLoading];
[mapView cacheViewIfNeeded];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was also an issue: cacheViewIfNeeded is called on finishLoading also, which is a tremendous overhead that is not necessary.
As caching an image is a CPU and RAM consuming job.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I'm sorry to say but this commit is quite flawed. It creates a global variable called didCallOnMapReady which once set to YES is never reset to NO. This breaks onMapReady quite badly, causing it now to only fire on the first rendered MapView and after that never again (not when MapView is unmounted/mounted, or for any other MapViews).

@danielgindi @christopherdro

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by PR #1853

@christopherdro christopherdro merged commit 3c3fc5c into react-native-maps:master Nov 28, 2017
@danielgindi danielgindi deleted the bugfix/ios_onMapReady branch December 31, 2017 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment