Sitelet https://rnmapbox.github.io/docs/components/Viewport
Skip to main content

Viewport

import { Viewport } from '@rnmapbox/maps';

Viewport

provides a structured approach to organizing camera management logic into states and transitions between them.

At any given time, the viewport is either:

  • idle
  • in a state (camera is being managed by a ViewportState)
  • transitioning between states

See android, ios

props​

transitionsToIdleUponUserInteraction​

boolean

Indicates whether the Viewport should idle when the MapView receives touch input.

Set this property to false to enable building custom ViewportStates that can work simultaneously with certain types of gestures.

Defaults to true.

onStatusChanged​

func

Subscribes to status changes, will be called when the status changes.

Observers are notified of status changes asynchronously on the main queue. This means that by the time the notification is delivered, the status may have already changed again. This behavior is necessary to allow observers to trigger further transitions while avoiding out-of-order delivery of status changed notifications. signature:(event:{from: union, to: union, reason: union}) => void

methods​

getState()​

arguments​

NameTypeRequiredDescription

idle()​

arguments​

NameTypeRequiredDescription

transitionTo(state, transition)​

arguments​

NameTypeRequiredDescription
staten/aYesundefined
transitionn/aYesundefined