mapbox / mapbox/mapbox-navigation-android

Mapview starts flicker in Viewpager2 when activate tab

Open
#7,454 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

**Android API:**
**Mapbox Navigation SDK version:**
implementation("com.mapbox.maps:android:10.14.1")
implementation("com.mapbox.mapboxsdk:mapbox-sdk-turf:6.12.0")
implementation("com.mapbox.plugin:maps-animation:10.15.0-rc.1")
implementation("com.mapbox.plugin:maps-compass:10.15.0-rc.1")
implementation("com.mapbox.plugin:maps-logo:10.15.0-rc.1")
implementation("com.mapbox.plugin:maps-scalebar:10.15.0-rc.1")

### Steps to trigger behavior

1. Using Viewpager2 with Fragment I have three tab in single activity one tab is map. When i tap or activate map fragment then mapview starts flickering. Same xml file which contains map is used at another fragment at different place there is no flicker issue.
2. When i set width of mapview to 500dp then it is working fine. It causes issue when width is match_parent

### Expected behavior
1. When activate tab then map should not flicker in match_parent width

### Actual behavior
3. When i activate tab map starts flickering and when i come back from side fragment in same activity then it is not flickering

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 reproducing the flicker with MapView inside an Android ViewPager2 Fragment using match_parent width and the listed Mapbox SDK versions; compare it with the 500dp case and the other fragment where the same XML works. Trace the MapView/ViewPager2 lifecycle and layout behavior, then verify that activating the map tab no longer flickers while preserving the match_parent layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
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.