rnmapbox / rnmapbox/maps

Android: When user pitches the map (two finger swipe gesture), isGestureActive becomes false when pitch starts to change

Open
#3,398 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug 🪲
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.73.5

Platform

Android

@rnmapbox/maps version

10.1.15

Standalone component to reproduce
import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  handleCameraChanged = event => {
    console.info(event);
  }

  render() {
    return (
      <MapView style={{flex: 1}} pitchEnabled={true} onCameraChanged={this.handleCameraChanged}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}
Observed behavior and steps to reproduce

Subscribe to the onCameraChanged event.

Use two-finger swipe gesture to pitch the map.

As soon as the pitch begins to change, event.gestures.isGestureActive is no longer true, even though a gesture continues to change the camera.

Below is the console output throughout the gesture.

Initially, isGestureActive is true until the pitch starts to change:

{"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76949914919413, 40.44890011367669], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169924817}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76948979894159, 40.448886276383405], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942334}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76945128224419, 40.44882927602503], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942501}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76943790734013, 40.44880948265798], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942521}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76939537579447, 40.44874654056354], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942580}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76934798672805, 40.4486764096866], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942634}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.7693433115996, 40.44866949098328], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942672}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.7693433115996, 40.44866949098328], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942691}
INFO {"gestures": {"isGestureActive": true}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76930279381648, 40.44860952874739], "heading": 332.78784802195764, "pitch": 0, "zoom": 14.729719614537556}, "timestamp": 1709169942739}

Then as soon as the pitch starts changing, isGestureActive changes to false:

INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76930278071364, 40.44860950935583], "heading": 332.78784802195764, "pitch": 0.5087463454715362, "zoom": 14.721734912821177}, "timestamp": 1709169942806}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76930274761084, 40.44860946036529], "heading": 332.7878480219577, "pitch": 1.6429687744821426, "zoom": 14.721762489106663}, "timestamp": 1709169942852}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76930273124742, 40.44860943614827], "heading": 332.7878480219577, "pitch": 2.176153596880341, "zoom": 14.721776100666105}, "timestamp": 1709169942902}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76930269670248, 40.44860938502342], "heading": 332.7878480219577, "pitch": 3.1861755845870903, "zoom": 14.721803015571325}, "timestamp": 1709169942973}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.7693026511539, 40.44860931761378], "heading": 332.78784802195764, "pitch": 4.374310367916677, "zoom": 14.72183596233926}, "timestamp": 1709169943052}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.769302576287, 40.448609206814496], "heading": 332.78784802195764, "pitch": 6.041284269709648, "zoom": 14.721885134883026}, "timestamp": 1709169943125}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.769302576287, 40.448609206814496], "heading": 332.78784802195764, "pitch": 6.041284269709648, "zoom": 14.721885134883026}, "timestamp": 1709169943171}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.769302331559, 40.44860884462916], "heading": 332.78784802195764, "pitch": 10.131714018161802, "zoom": 14.722022434555218}, "timestamp": 1709169943235}
INFO {"gestures": {"isGestureActive": false}, "properties": {"bounds": {"ne": [Array], "sw": [Array]}, "center": [-106.76930212442288, 40.44860853807786], "heading": 332.78784802195764, "pitch": 12.7110780702692, "zoom": 14.722121979119963}, "timestamp": 1709169943308}

Expected behavior

event.gestures.isGestureActive should remain true throughout the gesture.

Notes / preliminary analysis

Observed on Android only.

Works as expected on iOS.

Additional links and references

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Android handling behind MapView's onCameraChanged event and the two-finger pitch gesture, comparing the reported gesture state with the iOS behavior described here. Reproduce the issue using the supplied standalone component and verify that isGestureActive remains true until the gesture ends while pitch changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.