question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using Maptiler for style of the map crash the app after warning

See original GitHub issue

Since I can’t get map and Street style to work in my project, so now I use Maptiler style instead. I had the same issue as #1840. Maptiler style has support for Mapbox, so this workaround works until I encounter this warning message in the iOS Simulator and then the app will crash every time the view is loaded.

Mapbox warning [event]:ParseStyle [code]:-1 [message]:source must have tiles {"filePath": "virtual bool mbgl::MGLCoreLoggingObserver::onRecord(mbgl::EventSeverity, mbgl::Event, int64_t, const std::string &)", "level": "warning", "line": 27, "message": "[event]:ParseStyle [code]:-1 [message]:source must have tiles"}

I have cleared the cache deintegrate pods, and install pods again etc.

I have added hasFinishedLoadingStyle to see if that fix the problem and then apply the Camera and MapView:

 <MapboxGL.MapView
            ref={(c) => (this._map = c)}
            onLongPress={() => SheetManager.show(`map-${id}`)}
            style={style.maps}
            styleURL={`https://api.maptiler.com/maps/streets/style.json?key=${MAPTILER_TOKEN}`}
            logoEnabled={false}
            compassEnabled={false}
            pitchEnabled={false}
            onDidFinishLoadingMap={() => this.onDidFinishLoadingStyle()}>
            {this.state.hasFinishedLoadingStyle ? (
              <>
                <MapboxGL.Camera
                  animationDuration={1000}
                  animationMode={'linearTo'}
                  zoomLevel={14}
                  centerCoordinate={currentLocation}
                />
                <MapboxGL.MarkerView id={'marker'} coordinate={currentLocation}>
                  <View>
                    <View style={style.markerContainer}>
                      <View style={style.textContainer}>
                        <Text style={style.text}>{'Samling'}</Text>
                      </View>
                      <MapboxGL.PointAnnotation
                        id={'makerPoint'}
                        coordinate={currentLocation}
                      />
                      <Image
                        source={MapBikeWhiteUnselect}
                        style={{
                          width: 42,
                          height: 52,
                          backgroundColor: 'transparent',
                          resizeMode: 'cover',
                        }}
                      />
                    </View>
                  </View>
                </MapboxGL.MarkerView>
              </>
            ) : null}
          </MapboxGL.MapView>

Is there a way to use the setLogCallbackto ignore the messages to avoid the app to crash?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jjrisecommented, Jun 7, 2022

to future readers: this issue was caused from using LineGradient in my LineLayer component.

0reactions
gustaflindqvistcommented, Jun 14, 2022

to future readers: this issue was caused from using LineGradient in my LineLayer component.

@jjrise Might also be good to check is app has permission before using <UserLocation />. Found this solution: https://github.com/rnmapbox/maps/issues/233#issuecomment-522237807

Read more comments on GitHub >

github_iconTop Results From Across the Web

A brand new website interface for an even better experience!
Using Maptiler for style of the map crash the app after warning.
Read more >
[ANDROID] Mapbox.UserLocation crashes my app! · Issue #233
My app uses the new <UserLocation /> inside a <MapView /> . ... Using Maptiler for style of the map crash the app...
Read more >
Generalization in maps - MapTiler Support
Let's say I use Maptiler basic map and I'm trying to get the minor roads in zoom level 7+ to be visible at...
Read more >
GEOlayers 3 - Page 7 - aescripts + aeplugins
I am using a Mapbox map and I get the labe data just by using your ... be automatically able to use the...
Read more >
react-native-maps crash application on provider="google ...
I have an Expo app with react-native-maps and I want to set custom styles to the map like in this thread react-native-maps custom...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found