pavel-corsaghin / react-native-leaflet

A LeafletView component using WebView and Leaflet map for React Native applications
MIT License
114 stars 46 forks source link

Documentation is not clear at all #16

Open BasselTurky opened 2 years ago

BasselTurky commented 2 years ago

Are there built-in layers in this library? I want to use satellite tiles in my app. Also, I can't find any examples of how to use map Props.

noedelcroix commented 2 years ago

Hello, I'm not the maintainer of this project but you can check the src/LeafletView/types.ts file. There is the definition of each type used by this project. For your issue :

  1. Add mapLayers prop to your LeaftelView and pass an array containing MapLayer structure.
  2. In types.ts file, MapLayer structure is like this :
    export interface MapLayer {
    attribution?: string;
    baseLayer?: boolean;
    baseLayerIsChecked?: boolean;
    baseLayerName?: string;
    bounds?: LatLngBounds;
    id?: string;
    layerType?: MapLayerType;
    opacity?: number;
    pane?: string;
    subLayer?: string;
    url?: string;
    zIndex?: number;
    }
  3. The result have to be something like this :
    <LeafletView
    mapLayers={[
    { url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' }
    ]} />