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

[Bug]: isGestureActive is always false on android devices #3495

Open
vlasac opened this issue May 19, 2024 · 2 comments
Open

[Bug]: isGestureActive is always false on android devices #3495

vlasac opened this issue May 19, 2024 · 2 comments
Labels
bug 🪲 Something isn't working

Comments

@vlasac
Copy link

vlasac commented May 19, 2024

Mapbox Implementation

Mapbox

Mapbox Version

default

React Native Version

0.74.1 (expo: 51.0.8)

Platform

Android

@rnmapbox/maps version

10.1.24

Standalone component to reproduce

import React from "react";
import { StyleSheet, View, Dimensions } from "react-native";
import { MapView, setAccessToken } from "@rnmapbox/maps";

const MAPBOX_ACCESS_TOKEN = "pk.ey....";
const MAPBOX_STYLE_URL = "mapbox://styles/...";

export default function App() {
  setAccessToken(MAPBOX_ACCESS_TOKEN);

  return (
    <View style={styles.container}>
      <MapView
        style={styles.mapbox}
        styleURL={MAPBOX_STYLE_URL}
        scaleBarEnabled={false}
        onMapIdle={(mapState) => {
          console.log("MAP IDLE", mapState);
          
          if (mapState?.gestures.isGestureActive) {
            console.log("USER GESTURE");
          }
        }}
      ></MapView>
    </View>
  );
}

const { height, width } = Dimensions.get("window");

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
  mapbox: {
    width,
    height,
    padding: 0,
    margin: 0,
  },
});

Observed behavior and steps to reproduce

Bug description:

In the code example shared above you can see that there are two console logs in the onMapIdle function, the first one prints the whole map state and the second one is logged if the user gesture is active.

The code works in a sense that the event is invoked on every map idle, but the issue I noticed is that on Android devices the second log never appears in the console because isGestureActive is always false, regardless if the map has idled programatically or by user gesture.

On iOS this variable accurately reflects the state of the map interaction and both logs can be observed in the console after the user stops dragging the map.

Expected behavior

I would expect the same behaviour on Android as it is currently on iOS - the map state passed to the onMapIdle is always reflecting the current state of gesture interactions.

Notes / preliminary analysis

No response

Additional links and references

No response

@meribes124
Copy link

I am having this issue as well

@alainib
Copy link

alainib commented Jun 4, 2024

i have this issue too. i swipe the map fast , i get like lots of calls to onCameraChanged (normal) , many of them have
"isGestureActive": false and others "isGestureActive": true

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

3 participants