rnmapbox / rnmapbox/maps

[Bug]: Update tileUrl not working

Open
#3,611 3 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 Implementation

Mapbox

Mapbox Version

10.1.30

React Native Version

0.74

Platform

iOS, Android

@rnmapbox/maps version

10.1.30

Standalone component to reproduce
import React, { useEffect, useState } from "react";
import { MapView, RasterLayer, RasterSource } from "@rnmapbox/maps";

const Component = () => {
	useEffect(() => {
		setInterval(() => {
			setCurrentWeather((prev) => prev >= prev + 1);
		}, 500);
	}, []);
	const [currentWeather, setCurrentWeather] = useState(0);
	return (
		<MapView styleURL="mapbox://styles/mapbox/satellite-streets-v12">
			<RasterSource
				id="stamen-watercolor"
				tileSize={256}
				tileUrlTemplates={[
					`https://api.tomorrow.io/v4/map/tile/{z}/{x}/{y}/precipitationIntensity/${new Date(new Date().getTime() + currentWeather * 60 * 60 * 1000).toISOString()}.png?apikey=API_KEY`
				]}
			/>
			<RasterLayer id="stamen-watercolor-layer" sourceID="stamen-watercolor" style={{ rasterOpacity: 0.85 }} />
		</MapView>
	);
};
Observed behavior and steps to reproduce

When updating the prop tileURLTemplate, nothing happens. I checked the documentation and I don't find how to update a layer or a source like in the MapboxGL package for JS.

Expected behavior

The layer should update when updating the url

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 React Native component in the issue and reproduce the behavior using RasterSource and its tileUrlTemplates prop on iOS and Android. Trace how that prop is applied when currentWeather changes; done means the RasterLayer displays tiles from the updated URL on both platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.