Skip to content

details.isGesture undefined in onRegionChange() callback when map is dragged (iOS) #5488

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

Open
trooperandz opened this issue May 6, 2025 · 8 comments
Labels
bug Something isn't working

Comments

@trooperandz
Copy link

trooperandz commented May 6, 2025

Summary

The <MapView /> onRegionChange() callback details argument has undefined isGesture value when dragging the map.

This is contained in the second argument of the onRegionChange callback, i.e. :

onRegionChange={(region, details) => { console.log(details.isGesture) }

Reproducible sample code

import React from 'react';
import {
  Dimensions,
  StatusBar,
  StyleSheet,
  View,
} from 'react-native';
import MapView, {PROVIDER_GOOGLE} from 'react-native-maps';

const screenDimensions = Dimensions.get('screen');

  return (
    <View style={styles.container}>
      <StatusBar />
      <View style={styles.mapContainer}>
        <MapView
          onRegionChange={(region, details) => {
            console.log('onRegionChange...');
            console.log({details});
          }}
          provider={PROVIDER_GOOGLE}
          style={styles.map}
          region={{
            latitude: 37.78825,
            longitude: -122.4324,
            latitudeDelta: 0.015,
            longitudeDelta: 0.0121,
          }}
        />
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'white',
    flex: 1,
  },
  mapContainer: {
    ...StyleSheet.absoluteFillObject,
    height: screenDimensions.height,
    width: screenDimensions.width,
    justifyContent: 'flex-end',
    alignItems: 'center',
  },
  map: {
    ...StyleSheet.absoluteFillObject,
    backgroundColor: 'yellow',
  },
});

export default App;

Steps to reproduce

Drag the map from the following example above. Check the logs and notice that details.isGesture is always undefined.

Expected result

When dragging the map, the details.isGesture value should be true. When the map is returned to a set of coordinates (i.e. when using fitToCoordinates, the details.isGesture value should be false.

Actual result

When dragging the map, and when using fitToCoordinates, details.isGesture is always undefined.

React Native Maps Version

1.23.5

What platforms are you seeing the problem on?

iOS (Google Maps)

React Native Version

0.79.2

What version of Expo are you using?

Not using Expo

Device(s)

iPhone 12 mini

Additional information

No response

@trooperandz trooperandz added the bug Something isn't working label May 6, 2025
@iM-GeeKy
Copy link

iM-GeeKy commented May 10, 2025

@salah-ghanim This is still supported with the new architecture correct? I'm seeing the same behavior with the latest version and am using Expo 53.

@iM-GeeKy
Copy link

@trooperandz Have you been able to solve this? I've been able to use an AI agent to get a patch working for Android, but I'm still not having any luck on iOS.

@trooperandz
Copy link
Author

@iM-GeeKy I have not been able to solve this yet. For context, the onRegionChange() handler was not working at all (no gestures registering whatsoever) until a recent fix which was deployed last week. However, upon testing this and confirming that onRegionChange() was now registering user drags on the map (after the fix), I noticed that details.isGesture was always undefined.

@iM-GeeKy
Copy link

iM-GeeKy commented May 14, 2025

@trooperandz Okay thanks for the update, I'm seeing the same behavior too on iOS with provider google except with onRegionChangeComplete and as previously mentioned was able to get the android side of it working with a temporary patch and I'll keep trying with iOS until we get a fix.

@trooperandz
Copy link
Author

trooperandz commented May 15, 2025

One update on this; I see that Android details.isGesture is now working on Android (react-native-maps version 1.23.8), but it is still always undefined on iOS however.

@iM-GeeKy
Copy link

iM-GeeKy commented May 15, 2025

Yeah, I'm noticing the isGesture isn't making it into the generated code, partially explains why it's always undefined. I've managed to get it working with a patch, but I'm still regression testing it.

@bobanminic96
Copy link

bobanminic96 commented May 16, 2025

+1 (version 1.28.3)
react-native 0.79.1
react 19.0.0

Same, android looks ok, but iOS is not working, still undefined. Any workaround?

@trevor-coleman
Copy link

trevor-coleman commented May 16, 2025

Also seeing this on expo 53.

And onRegionChangeStart is supposed to be of type (e:NativeSyntheticEvent<Details>)=>void but the actual event argument has a different shape.

When I log e.nativeEvent I get:

{
    "region": {
        "latitude": 0,
        "longitude": 0,
        "latitudeDelta": 0,
        "longitudeDelta": 0
    },
    "continuous": false,
    "target": 36
}

@trooperandz trooperandz changed the title details.isGesture undefined in onRegionChange() callback when map is dragged (Android and iOS) details.isGesture undefined in onRegionChange() callback when map is dragged (iOS) May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants