-
-
Notifications
You must be signed in to change notification settings - Fork 850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Existing layers when the map is offline #3152
Comments
I got some similar errors when changing the styleURL. This one seems to be caused by the compass:
|
I don't see this warning on main. I've needed to add existing flags for the source and layer as those were referring to existing layers in the style: 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" existing>
<Mapbox.FillLayer
id="national-park"
sourceLayerID="landuse_overlay"
sourceID="composite"
existing
style={styles.overlay}
/>
</Mapbox.VectorSource>
</MapView>
</>
);
};
export default BugReportExample; |
@mfazekas It always reproduces even with |
@orca-nazar can you be please more specific. Which @rnmapbox/maps version have you tested with , which component you've tried? The one in my comment? - #3152 (comment) |
Correct, I use the latest version and your component |
@orca-nazar I don't see the issue on current #main. 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
defaultSettings={{
centerCoordinate: [-74.00597, 40.71427],
zoomLevel: 8,
}}
/>
<Mapbox.VectorSource id="composite" existing>
<Mapbox.FillLayer
id="national-park"
sourceLayerID="landuse_overlay"
sourceID="composite"
existing
style={styles.overlay}
/>
</Mapbox.VectorSource>
</MapView>
</>
);
};
export default BugReportExample; Screen.Recording.2023-12-06.at.14.14.14.mov |
I think we need to add a check that if component is declared maps/android/src/main/java/com/rnmapbox/rnmbx/components/styles/layers/RNMBXLayer.kt Lines 286 to 299 in 12946ef
|
Sounds good. Also, I'm wondering if this technique can be useful for the next case:
So it could applied to filters and styles props updates |
Hi, any updates on this issue? I'm experiencing the same issue on Android, on iOS it looks without any problem. Thank you |
Mapbox Implementation
Mapbox
Mapbox Version
10.16.1
Platform
Android
@rnmapbox/maps
version#main
Standalone component to reproduce
Observed behavior and steps to reproduce
In our app we experience this issue when styles are switched in 2 scenarios
onDidFinishLoadingMap
is firedThe second scenario could be reproducable by using BugReportExample
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
The text was updated successfully, but these errors were encountered: