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

OnRegionChangeComplete always returns to initialRegion #1507

Closed
sagi opened this issue Jul 24, 2017 · 2 comments
Closed

OnRegionChangeComplete always returns to initialRegion #1507

sagi opened this issue Jul 24, 2017 · 2 comments

Comments

@sagi
Copy link
Contributor

sagi commented Jul 24, 2017

Bug

onRegionChangeComplete event resets back to initialRegion.

It happens on iOS while using Google Maps (PROVIDER_GOOGLE).

Example (video):

onRegionChangeComplete always returns to initialRegion

Reproduction

First we'll need a copy of the master branch, lets call it blaster:

$ git checkout -b blaster master

Now to make it compile (master is broken) we'll have to "cherry pick" the following PRs:

Apply it to the blaster branch with:

$ curl https://github.com/airbnb/react-native-maps/commit/e580b706cfed4d7dac8fc2d6bb7d81f5cd3392e5.patch | git am
$ curl https://github.com/airbnb/react-native-maps/commit/32350e26cf7c2be6031dbabf23b8e27cd7269c00.patch | git am

Now simply:

$ rm -rf node_modules
$ npm install

And,

$ npm run build:ios && npm run run:ios
@foyarash
Copy link
Contributor

foyarash commented Aug 4, 2017

Same here using MapKit

@foyarash
Copy link
Contributor

foyarash commented Aug 7, 2017

The problem seems to come from the setInitialRegion function which is never called.

I tried a workaround like this in the AIRMapManager.m

RCT_CUSTOM_VIEW_PROPERTY(initialRegion, MKCoordinateRegion, AIRMap)
{
if (json == nil) return;

// don't emit region change events when we are setting the region
BOOL originalIgnore = view.ignoreRegionChanges;
view.ignoreRegionChanges = YES;
[view setInitialRegion:[RCTConvert MKCoordinateRegion:json]];
view.ignoreRegionChanges = originalIgnore;
}

but it does not work, json variable is nil and I don't know why. I'm not an ObjC developer, so some help would be appreciated :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants