rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.28k stars 848 forks source link

Unable to use my custom style - Black Screen #3691

Closed ABertaud closed 1 week ago

ABertaud commented 1 week ago

Environment

Steps to reproduce

Create custom style on mapbox studio. Make it standard, and publish it as public. Here's the preview.

From share button retrieve the styleURL and use it directly into your component.

import React from 'react';
import { StyleSheet, View } from 'react-native';
import Mapbox from '@rnmapbox/maps';

Mapbox.setAccessToken('<YOUR_ACCESSTOKEN>');

const App = () => {
  return (
    <View style={styles.page}>
      <View style={styles.container}>
        <Mapbox.MapView style={styles.map} styleURL="<STYLE_URL>" />
      </View>
    </View>
  );
}

export default App;

const styles = StyleSheet.create({
  page: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  container: {
    height: 300,
    width: 300,
  },
  map: {
    flex: 1
  }
});

Now i'm encountering a black screen. Note two things:

Really looking forward some help!

ABertaud commented 1 week ago

Solved by using mapbox v11 instead of default v10.