Skip to content

Conversation

@kesha-antonov
Copy link

Hello!

I guess I've found answer for fix these: #1596 & #1577

onRegionChangeComplete fired again when next tiles are loaded.

According to these comments:
screen shot 2017-08-26 at 14 50 02
in this commit 8a86e98

@draperunner
Copy link

draperunner commented Sep 19, 2017

This is good, and we use this in my team's project. But it introduces a problem when using region and moving the map programmatically. We set a default location in our map container's contructor, then update the region when the user's location has been received. The map does not move from the default location.

These changes mentioned here: #1577 (comment) seem to fix it for iOS. For Android, it updates most of the time, but not always. Adding this change to componentWillUpdate seems to fix that:

  componentWillUpdate(nextProps) {
    const a = this.__lastRegion;
    const b = nextProps.region;
    if (!b) return;
    if (
      !a ||
      a.latitude !== b.latitude ||
      a.longitude !== b.longitude ||
      a.latitudeDelta !== b.latitudeDelta ||
      a.longitudeDelta !== b.longitudeDelta
    ) {
      this.map.setNativeProps({ region: b });
    }
  }

@rborn
Copy link
Collaborator

rborn commented Mar 4, 2020

Closing as being an old PR and not a clear reply. Thanks for all the effort 😻

@rborn rborn closed this Mar 4, 2020
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

Successfully merging this pull request may close these issues.

5 participants