1

I am React Native developer and I am building a shuttle Bus application using Mapbox. I got some questions while I was working on my project :)

Using the same code, I can load Mapbox map on Android emulator, however I cannot load map on iOS. I am testing with the example code on React Native Mapbox v10 Github Library. I am using Xcode v13, latest version of RN, latest version of Mapbox RN. Thank you.

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

MapboxGL.setAccessToken('<YOUR_ACCESSTOKEN>');

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

export default class App extends Component {
  render() {
    return (
      <View style={styles.page}>
        <View style={styles.container}>
          <MapboxGL.MapView style={styles.map} />
        </View>
      </View>
    );
  }
}
Jeongmoo
  • 11
  • 1

1 Answers1

0

What worked for me is adding a styleURL={MapboxGL.StyleURL.Street} to my mapview

Something like this

<MapboxGL.MapView styleURL={MapboxGL.StyleURL.Street} style={styles.map} />
Moritz Ringler
  • 9,772
  • 9
  • 21
  • 34