[iOS] Cannot create property 'create' of undefined (MapboxGL.StyleSheet.create)
See original GitHub issueDescribe 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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
[iOS] Cannot create property 'create' of undefined (MapboxGL ...
I am trying to create a simple map with custom styling on FillLayer, however I am unable to declare styling. Trying MapboxGL.StyleSheet.create ......
Read more >rnmapbox/Lobby - Gitter
Hey,. is it possible to use an uri as source for the iconImage in a MapboxGl.SymbolLayer? I tried two things: First: const styles...
Read more >Cannot display MAP from react-map-gl and Mapbox
1 Answer 1 · Make sure the mapStyle from Studio mapbox and mapboxApiAccessToken are correctly paired. · The width and height in viewport...
Read more >mapbox-gl | Yarn - Package Manager
Mapbox GL JS is a JavaScript library for interactive, customizable vector maps on the web ... Add support for cameraForBounds with globe projection...
Read more >Styles | Mapbox Studio manual
Without layers, you cannot see your data. You can create multiple layers from the same data and you can filter data by attributes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@HPieters yes thanks for the issue i hope i’ve clarified it in migrations notes in changelog
Seems to work great, thanks once again!