1.0.1 • Published 7 years ago

react-mapbox-gl-language v1.0.1

Weekly downloads
26
License
MIT
Repository
github
Last release
7 years ago

react-mapbox-gl-language

Switch language of your Mapbox GL JS style with React.

This package is a simple binding of mapbox-gl-language for React.

It was designed to use with react-mapbox-gl.

Installation

npm i --save mapbox-gl @mapbox/mapbox-gl-language react-mapbox-gl react-mapbox-gl-language

or

yarn add mapbox-gl @mapbox/mapbox-gl-language react-mapbox-gl react-mapbox-gl-language

Example

import React from 'react';
import ReactDOM from 'react-dom';
import ReactMapboxGl from 'react-mapbox-gl';
import MapboxLanguageControl from 'react-mapbox-gl-language';

const Map = ReactMapboxGl({
  accessToken: '<YOUR ACCESS TOKEN HERE>'
});

const styles = {
  mapContainer: {
    height: '100vh',
    width: '100vw'
  }
};

const App = () => (
  <Map
    style='mapbox://styles/mapbox/streets-v10'
    containerStyle={styles.mapContainer}
  >
    <MapboxLanguageControl/>
  </Map>
);

const MOUNT = document.getElementById('root');

ReactDOM.render(
  <App/>,
  MOUNT
);