Skip to content

[Bug]: changing centerCoordinate prop doesn't move camera when screen is not focused #4203

@Alvi24

Description

@Alvi24

Mapbox Version

default

React Native Version

0.83.6

Platform

iOS

@rnmapbox/maps version

10.3.0

Standalone component to reproduce

import React, { Camera, MapView } from "@rnmapbox/maps";
import { useEffect, useState } from "react";

const BugReportExample = () => {
// context
  const [centerCoordinates, setCenterCoordinates] = useState([
    -74.00597, 40.71427,
  ]);

// update on other screen
  useEffect(() => {
    setTimeout(() => {
      setCenterCoordinates([51.5074, -0.1278]);
    }, 1000);
  });

  return (
    <MapView>
      <Camera centerCoordinate={centerCoordinates} />
    </MapView>
  );
};

Observed behavior and steps to reproduce

In a tabs layout when centerCoordinate prop on Camera component changes the Camera doesn't move to the updated center coordinates

Expected behavior

the camera should move to the updated center coordinates

Notes / preliminary analysis

No response

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