[Bug]: Existing layers when the map is offline
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 2.9k
- Forks
- 947
- Avg merge
- 6d 37m
- Merged PRs (30d)
- 1
Description
Mapbox Implementation
Mapbox
Mapbox Version
10.16.1
Platform
Android
@rnmapbox/maps version
#main
Standalone component to reproduce
import Mapbox, { Camera, MapView } from '@rnmapbox/maps';
import React, { useState } from 'react';
import { Button } from 'react-native';
const getStyles = (isDark) => ({
mapView: { flex: 1 },
overlay: {
fillColor: isDark ? 'hsl(76,26%,75%)' : 'hsl(200,46%,69%)',
},
});
const { Dark, Light } = Mapbox.StyleURL;
const BugReportExample = () => {
const [styleUrl, setStyleUrl] = useState(Light);
const isDark = styleUrl === Dark;
const buttonTitle = isDark ? 'Set Light' : 'Set Dark';
const styles = getStyles(isDark);
return (
<>
<Button
title={buttonTitle}
onPress={() => setStyleUrl(isDark ? Light : Dark)}
/>
<MapView style={styles.mapView} styleURL={styleUrl}>
<Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
<Mapbox.VectorSource id="composite">
<Mapbox.FillLayer
id="national-park"
sourceLayerID="landuse_overlay"
sourceID="composite"
style={styles.overlay}
/>
</Mapbox.VectorSource>
</MapView>
</>
);
};
export default BugReportExample;
Observed behavior and steps to reproduce
In our app we experience this issue when styles are switched in 2 scenarios
- Fast switching between dark and satellite mode (can't reproduce it in Example app). Our workaround is to apply(mount) custom sources and layers only after
onDidFinishLoadingMapis fired - In offline mode between switching dark and light mode
The second scenario could be reproducable by using BugReportExample
- In online mode open Bug Report Template TS
- Go Offline
- Switch to Dark mode. Dark styles will be missed as no connection
- Switch back to Light mode.
Actual result:Error while updating property 'reactStyle' of a view managed by: RNMBXFillLayer null Set layer property "fill-color" failed: Layer national-park is not in style:
Expected behavior
No issues
Notes / preliminary analysis
It happens only when color is dynamically changed:
fillColor: isDark ? 'hsl(76,26%,75%)' : 'hsl(200,46%,69%)',
No issues in this case:
fillColor: 'hsl(76,26%,75%)'
Additional links and references
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the BugReportExample reproduction and the RNMBXFillLayer style-update path involved when MapView switches between Light and Dark offline. Reproduce the offline sequence, then trace how the dynamically changing fillColor is applied after the style change. Done means switching styles offline no longer reports that the national-park layer is missing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, 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