react-native-maps icon indicating copy to clipboard operation
react-native-maps copied to clipboard

Android AnimatedToRegion not always working

Open nodabasi opened this issue 1 year ago • 1 comments

Summary

In componentDidMount I am triggering my focus function and i am be able to show that location, however when i try it with a button to another location, same function doesn't work. I can see the "pp" log everytime but it doesnt make any affection. In ios it works fine.

Reproducible sample code

focusLocation(location) {
    if (location) {
      this.setState({ region: location });
        if (this.state.gms) {
          console.log("pp")

          this.refs.map?.animateToRegion({
            latitude: location.latitude,
            longitude: location.longitude,
            latitudeDelta: location.latitudeDelta,
            longitudeDelta: location.longitudeDelta
          }, 500);
      }
    }
  }

Steps to reproduce

Whenever i try to trigger it with my button, it gets into function but no affect on the map

Expected result

Focusing to new Region

Actual result

It doesn't focus when i try

React Native Maps Version

0.27.1

What platforms are you seeing the problem on?

Android

React Native Version

0.70.10

What version of Expo are you using?

Not using Expo

Device(s)

Android 13

Additional information

No response

nodabasi avatar Dec 14 '23 08:12 nodabasi

Hi, thabks for reporting this! What is the location passed in as an argument? Are you sure it always have the latitudeDelta and longtitudeDelta? I treid to reproduce on my end. I faced the same issue when I called the focusLocation as mapview onPress

<MapView
          provider={this.props.provider}
          style={styles.map}
          initialRegion={this.state.region}
          showsUserLocation
          onPress={e => this.focusLocation(e.nativeEvent)}
          ref={this.mapRef}
        />

because the latitudeDelta and longtitudeDelta were undefined. Can you provide full reproducible code? Also if you could please attach a recording and / or logcat logs I would find a solution for you faster :D

jan-kozinski avatar Dec 15 '23 00:12 jan-kozinski

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If the issue remains relevant, simply comment Still relevant and the issue will remain open. Thank you for your contributions.

github-actions[bot] avatar Mar 14 '24 01:03 github-actions[bot]