[Bug]: isGestureActive is always false on android devices
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 2.9k
- Forks
- 947
- Avg merge
- 6d 37m
- Merged PRs (30d)
- 1
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the onMapIdle callback and the mapState.gestures.isGestureActive value in the standalone React Native reproduction, comparing Android with the currently correct iOS behavior. Reproduce the issue on Android with @rnmapbox/maps 10.1.24, then trace the Android gesture-state handling until user-driven idle events report the correct value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100