Describe the bug
I am trying to create a simple map with custom styling on FillLayer, however I am unable to declare styling. Trying MapboxGL.StyleSheet.create results in Cannot create property 'create' of undefined. Only tested on iOS so far. On actual device the error is undefined is not an object (evaluating _maps.default.StyleSheet.create).
To Reproduce
- Create a new react native app
- Install @react-native-mapbox/maps
- Replace App.js into the following code
import React, { Component } from "react";
import { StyleSheet, View, Dimensions } from "react-native";
import MapboxGL from "@react-native-mapbox/maps";
const { height: screenHeight, width: screenWidth } = Dimensions.get("window");
MapboxGL.setAccessToken("<your token>");
const mapStyle = MapboxGL.StyleSheet.create({
buildings: {
fillColor: "blue"
},
street: {
lineColor: "green"
}
});
export default class App extends Component {
render() {
const height = screenHeight;
const width = screenWidth;
return (
<View style={styles.container}>
<MapboxGL.MapView
style={{ height, width }}
onDidFailLoadingMap={error => {
console.log(error);
}}
zoomLevel={17}
zoomEnabled
>
<MapboxGL.Camera followZoomLevel={12} />
<MapboxGL.FillLayer style={mapStyle.buildings} />
</MapboxGL.MapView>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#F5FCFF"
}
});
Expected behavior
A map is rendered with the styles applied to the fill layer.
Screenshots
If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
- Platfrom: iOS
- Device: Simulator
- OS: iOS 12.2
- SDK Version: Latest
- React Native Version: 0.59.8
Additional context
Without MapboxGL.StyleSheet.create the example above works.
Describe the bug
I am trying to create a simple map with custom styling on FillLayer, however I am unable to declare styling. Trying
MapboxGL.StyleSheet.createresults inCannot create property 'create' of undefined. Only tested on iOS so far. On actual device the error isundefined is not an object (evaluating _maps.default.StyleSheet.create).To Reproduce
Expected behavior
A map is rendered with the styles applied to the fill layer.
Screenshots
If applicable, add screenshots to help explain your problem.
Versions (please complete the following information):
Additional context
Without MapboxGL.StyleSheet.create the example above works.