Skip to content

[Bug]: Viewport transition is non-optional on iOS #4226

@rosemaryroach-slateauto

Description

@rosemaryroach-slateauto

Mapbox Version

default

React Native Version

0.81.5

Platform

iOS

@rnmapbox/maps version

10.3.1

Standalone component to reproduce

import React, { useEffect, useRef } from 'react';
import { MapView, Viewport } from '@rnmapbox/maps';

function BugReport() {
  const viewportRef = useRef<Viewport>(null);

  useEffect(() => {
    viewportRef.current?.transitionTo({kind: "followPuck"})
  }, [])

  return (<MapView>
    <Viewport ref={viewportRef} />
  </MapView>)
}

Observed behavior and steps to reproduce

Calling transitionTo without a transition specified (allowed by the type) throws a "Mapbox [error] no kind found in state" error.

This is both a non-descriptive error (there is a kind in the state, just not one in the transition) and also a type mismatch between typescript and swift.

Expected behavior

transitionTo should work without a transition specified, defaulting to "default."

Notes / preliminary analysis

I can see the guard in toTransition in RNMBXViewport.swift which causes this error.

Additional links and references

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🪲Something isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions