mapbox / mapbox/mapbox-maps-flutter

[ANDROID] OnPointAnnotationClickListener doesn't listen to taps when used with TapInteraction with stopPropagation

Open
#1,009 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

On Android platform, OnPointAnnotationClickListener doesn't listen to taps when map uses TapInteraction with PointAnnotationManager ID and stopPropagation set to true. On iOS it works fine.

```
_pointAnnotationManager =
await _mapboxMap?.annotations.createPointAnnotationManager();
_pointAnnotationManager?.addOnPointAnnotationClickListener(
AnnotationPointClickListener((annotation) async {
//NOTHING HAPPENS HERE
print(annotation.id)
...

final tapInteraction = TapInteraction(
FeaturesetDescriptor(layerId: _pointAnnotationManager?.id),
(feature, context) {},
stopPropagation: true,
);
_mapboxMap?.addInteraction(
tapInteraction,
interactionID: 'tap_interaction',
);

class AnnotationPointClickListener extends OnPointAnnotationClickListener {
AnnotationPointClickListener(this.onClicked);

final Function(PointAnnotation annotation) onClicked;

@override
void onPointAnnotationClick(PointAnnotation annotation) {
onClicked(annotation);
}
}

```

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

Reproduce the Android case using a PointAnnotationManager, TapInteraction, and stopPropagation set to true, then compare it with the iOS behavior. Trace the annotation click and tap interaction handling to determine why the listener is not called; done when the listener fires for Android without breaking the interaction behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.