-
-
Notifications
You must be signed in to change notification settings - Fork 846
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
Markers / shapeSource not showing when offline. #774
Comments
@386sx thank for the report. I think this is an upstream issue. Mapbox has a default styleURL even if you don't specify it. I think if the url is not reachable then the map renders nothing at all, you should get a https://docs.mapbox.com/android/maps/overview/styling-map/#style-object You can create offlinePacks to work around this. I'm closing this as this is the documented behavior of the libraries we use, not much we can do about it. |
I specify a mapstyle url, I just didnt post it here since it is my private server. The problem occurs on any map style. |
I would really appreciate if you reopened the issue and looked properly at it. What you are describing has nothing to do with the issue reported here. |
@386sx sorry i might have misreaded the original issue. It seems that you're in dev mode and you cannot access the RN Bundler that serves the assets in dev mode. See the pinpaid.png warning screen you posted above. |
No, this also happens on the release build from the store. This is just a clue that iOS is giving here, on Android there is no error or warning whatsoever. (That is how I learned about it. Users reported it) |
@386sx so there are 2 known issues:
So in your case the map is rendered but symbols are not shown?! So not (2.), but running in prod mode so not (1.)?! |
I'm reopened the issue but we need reproduction steps, that's not demonstrating either of the 2 known issue mentioned above. If you want to reproduce the issue in dev mode, probably the best way to run in emulator and disable wifi on the machine, so the connection to asset bundler is still alive, but no connection to mapbox servers. |
Yes, I am aware of both those issues, but this is something else. I am used to sometimes not seeing markers because of lacking connection to the asset server, and of course without a mapstyle or offline pack you wouldn't see the map at all. And, if it was the first issue, I would still see the text rendered in the markers, without the png. In my case, nothing is appearing. Would the problem be expected behaviour when used on a cached map view? So if I did not load a offline pack and used the map view that was cached from just viewing it?
./assets/: |
On very important thing when running this:
|
@386sx but does the map loads?! |
Yes sure, the map loads. And the issue occurs with offlinePacks installed and working. In the code above the map shows because it is cached but I would assume that the style gets cached es well. There is no difference in behaviour with or without offlinePacks intalled, but of course I tried both, as mentioned even as a packed and signed release app. |
@386sx i think i was able to reproduce with our example app too on iOS simulator. A quick debugging showed no issue from our side, so likely it's coming from upstream. Not related but you don't need |
Ok, thanks for the info. Yeah, |
@386sx well actually for me it seems what I could reproduce is a 3.-rd issue: #3. If a SymbolLayer has text and the map is offline, and the font used to render the symbol label has not been cached then the symbols will not be displayed. It seems that even symbols without label will be omitted. See mapbox/mapbox-gl-native#12167, mapbox/mapbox-plugins-android#970 I've used the example bellow. import React from 'react';
import {Button} from 'react-native';
import {
MapView,
ShapeSource,
SymbolLayer,
Camera,
Images,
} from '@react-native-mapbox-gl/maps';
const features = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
id: 'a-feature',
properties: {
icon: 'example',
text: 'example-icon-and-label',
},
geometry: {
type: 'Point',
coordinates: [-74.00597, 40.71427],
},
},
{
type: 'Feature',
id: 'b-feature',
properties: {
text: 'just-label',
},
geometry: {
type: 'Point',
coordinates: [-74.001097, 40.71527],
},
},
{
type: 'Feature',
id: 'c-feature',
properties: {
icon: 'example',
},
geometry: {
type: 'Point',
coordinates: [-74.00697, 40.72427],
},
},
],
};
const featuresWoLabel = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
id: 'a-feature',
properties: {
icon: 'example',
},
geometry: {
type: 'Point',
coordinates: [-74.00597, 40.71427],
},
},
{
type: 'Feature',
id: 'c-feature',
properties: {
icon: 'example',
},
geometry: {
type: 'Point',
coordinates: [-74.00697, 40.72427],
},
},
],
};
class BugReportExample extends React.Component {
state = {
showSymbols: true,
showLabels: false,
key: true,
};
render() {
return (
<>
<Button
title={this.state.showSymbols ? 'Hide symbols' : 'Show symbols'}
onPress={() => this.setState({showSymbols: !this.state.showSymbols})}
/>
<Button
title={this.state.showLabels ? 'Hide labels' : 'Show labels'}
onPress={() => this.setState({showLabels: !this.state.showLabels})}
/>
<Button
title={this.state.key ? 'Key: b' : 'Key a'}
onPress={() => this.setState({key: !this.state.key})}
/>
<MapView style={{flex: 1}}>
<Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
<Images
images={{
example:
'data:image/png;base64,iVB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IoJmjbjHKb081IjGL7ClPgZjeA1MU+U/6F2BloqxI1krGB45MwBDZUFXFHmZWgT8xN7y2Dp5uPJ3U79UBbh00OmIlkqmLHvHTmhRGJshfQIFgWb4NEmP16/SKqO5Ezn1fIjmscu242vLMxbJekRRIZvDTwIrXzsx19cUrQyQf83mc6rtSsMX2/go5p9+kkup/S10f+LpiM7epEt7EHr4gHoXftt95tMfufzSBuvoWBqp0334Ow7vXz3l18dGF/mqt9ksf1hFMp47HtG8+Hscx+YyPnlaA2856rfZDBwn+1CEYObsQ5obq8fm8R61Ry/hpF6Sjqv1uELb7fTgG/9SEDd6PPQFuc/m8U+WcY38fj5j7YuqXHUJ20T8O96xnXPYgVzE0x8aoZG8NdUbU56XJ7xFaSNP5envpMekDfwUlvkGv2BJ0uA1B7lIP3Q54sWg5u5HdDDs34k0JUe6ef8d0nnoW6Bgdueg+bP+pFYU3qpzPnpfzkxDU+O+S23Xrary/xIfFSt8H8J9BQ4n2elfU0MvHSvh3Z9Ah35zI/CuKkjeY5vnOO9X9o35RZ4zrMT2n0v9PgQr0ivGy6MFuhgO/s7xv7fkPbBNEn9n493oJW5Ddr6EjTLV0mbN0PT30DLT0KLE9DCJPSfd6GlkM/M/iU9P0VRFEVRFEVRFEVRFKUx+Bf7EbtqCt8N3QAAACV0RVh0Y3JlYXRlLWRhdGUAMjAwOC0wMy0xNFQxOToyOTo0Mi0wNDowMD++m78AAAAldEVYdG1vZGlmeS1kYXRlADIwMDgtMDMtMTRUMTk6Mjk6NDItMDQ6MDBgD+2LAAAAAElFTkSuQmCC',
}}
/>
{this.state.showSymbols && (
<ShapeSource
id={`shape-source-id-${this.state.key ? 'a' : 'b'}`}
key={`key-${this.state.key ? 'a' : 'b'}`}
shape={this.state.showLabels ? features : featuresWoLabel}>
<SymbolLayer
id="symbol-id"
style={{
iconImage: ['get', 'icon'],
textField: ['get', 'text'],
}}
/>
</ShapeSource>
)}
</MapView>
</>
);
}
}
export default BugReportExample; |
I'm closing this these are the known issues, let me know if this is something else:
|
Ok, thanks for the effort. The most likely issue here is imho no. 3, will investigate that further. |
Just a heads-up on that issue. It is this problem: mapbox/mapbox-gl-native#12167 |
One more thing, that finally solved this: |
We are also having issue #3 and am looking for advice and/or a solution to have map symbols appear when offline. |
I'm also having a problem on n3, does anyone have an example? |
@NathanNovak , @Kayre-Scott-Primon, please open a new ticket while following the issue ticket in order for this to get looked at. |
Describe the bug
Markers not showing while viewing the map offline
To Reproduce
Run this component, one time connected with
featureCollection
commented out (so the shapesource / markers won't be loaded and cached, but the mapstyle is loaded), then uncommentfeatureCollection
and go offline. Relaunch the app, and the shapeSource won't be rendered. If you now connect, the shapesource will appear and render the markers.It doesn't seem to be a linking problem, any other image asset is showing in the app and the markers don't show the text either, so somehow the shapeSource need net connection to get rendered. Although the images are locally imported / required it tries to pull them apparently over http (see screenshot).
Expected behavior
Markers should be visible online and offline.
Screenshots
If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
Platform: Android / iOS
Device: Pixel 3XL (and any other), iPhone 11x
Emulator/ Simulator: no
OS: Android 7 - 10 / iOS 13
react-native-mapbox-gl Version 7.2.0 / 8.0 rc
React Native Version 0.60.5
Additional context
As soon as I switch on the connection the pins show up without any action.
I set up a fresh react-native application, the behaviour is the same. The shapeSource is not being rendered when I'm not connected.
The text was updated successfully, but these errors were encountered: