Skip to main content

Location Cycling

Cycle the camera between preset locations using Camera ref flyTo animations.

Sample code

import { useRef } from "react";
import { Camera, Map, TrimbleMaps } from "@trimblemaps/maps-react-native";

const LOCATIONS = [
  { name: "Princeton", center: [-74.6672, 40.3573] as [number, number] },
  { name: "Richmond", center: [-77.436, 37.5407] as [number, number] },
  { name: "Pittsburgh", center: [-79.9959, 40.4406] as [number, number] },
];

cameraRef.current?.flyTo({
  center: LOCATIONS[index].center,
  zoom: 12,
  duration: 600,
});

Tap a button to advance to the next location in the list.

Last updated September 3, 2026.