fix(Viewport): allow transitionTo without an explicit transition on iOS#4247
Merged
Conversation
transitionTo's transition arg is optional in TypeScript, but on iOS the missing kind hit a guard in toTransition and aborted with 'no kind found in state', so the transition never ran. Default to the 'default' transition when no kind is provided, matching Android and the TS types. Fixes #4226
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4226
Viewport.transitionTo(state, transition?)types the transition as optional, and Android already handles a missing transition (falls back to Mapbox's default). On iOS, though,toTransitionguarded on the transition'skindand returnednilwhen it was absent, sotransitionToaborted with a non-descriptiveMapbox [error] no kind found in stateand never ran the transition.This defaults to the
defaulttransition when nokindis provided, matching Android and the TypeScript types.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Screenshot OR Video
Verified on the iOS example (New Arch, Mapbox v11). Before the fix, calling
transitionTo({ kind: 'followPuck' })with no transition logged:After the fix the transition runs and resolves (
transitionTo completed: true); the camera transitions to follow the puck.Component to reproduce the issue you're fixing
Reproducer