mapbox / mapbox/mapbox-navigation-ios

[Bug]: `StyleManager.refreshAppearance(for:)` can break unrelated views

Open
#4,819 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
918
Forks
326
Avg merge
1h 16m
Merged PRs (30d)
3

Description

### Mapbox Navigation SDK version

3.12.1

### Steps to reproduce

This behavior was originally introduced in https://github.com/mapbox/mapbox-navigation-ios/pull/519#discussion_r134604014

1. Create an app that doesn't immediately user MapBox screens
1. Add an arbitrary `UIView` to `UIWindow`
1. Create constraints between this view and the window
1. Instantiate `NavigationViewController`
1. Set `NavigationViewController.showsSpeedLimits = false`
1. This is going to cause `StyleManager.refreshAppearance(for:)` call

### Expected behavior

Arbitrary `UIView` is left untouched, still constrained to the `UIWindow`

### Actual behavior

Any unrelated `UIView` that is direct child of the `UIWindow` gets removed, losing the constraints, and re-added back to the window.

### Is this a one-time issue or a repeatable issue?

repeatable

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 at StyleManager.refreshAppearance(for:) and reproduce the issue by adding an arbitrary UIView with window constraints before instantiating NavigationViewController and setting showsSpeedLimits to false. Trace how the refresh handles direct UIWindow children; done means the unrelated view remains attached and its constraints are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.