Skip to content

Instantly share code, notes, and snippets.

@stepankuzmin
Created October 12, 2017 11:43
Show Gist options
  • Save stepankuzmin/fc24243eb375b405ce6ef45045c85a54 to your computer and use it in GitHub Desktop.
Save stepankuzmin/fc24243eb375b405ce6ef45045c85a54 to your computer and use it in GitHub Desktop.
Mapbox GL JS Style Immutable Flowtype
// @flow
import mapboxgl from 'mapbox-gl';
import { Record } from 'immutable';
import type { RecordFactory, RecordOf } from 'immutable';
type MapStyleProps = {
version: number,
name: ?string,
center: ?[number, number],
zoom: ?number,
bearing: ?number,
pitch: ?number,
light: ?Object,
sprite: ?string,
glyphs: ?string,
transition: ?Object,
sources: Object,
layers: Array<Object>
};
export type MapStyle = RecordOf<MapStyleProps>;
const makeMapStyle: RecordFactory<MapStyleProps> = Record({
version: 8,
name: undefined,
center: null,
zoom: null,
bearing: null,
pitch: null,
light: null,
sprite: null,
glyphs: null,
transition: null,
sources: {},
layers: []
});
export default makeMapStyle;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment