rnmapbox / rnmapbox/maps

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

Open
#4,203 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug 🪲
Dominant language
Kotlin
Stars
2.9k
Forks
947
Avg merge
6d 37m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the standalone BugReportExample and reproduce the issue in an iOS tabs layout using @rnmapbox/maps 10.3.0. Trace how Camera receives centerCoordinate changes while its screen is unfocused. Done means changing the prop moves the camera to the updated coordinates.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.