1.2.8 • Published 5 years ago

alopeyk-map v1.2.8

Weekly downloads
3
License
MIT
Repository
-
Last release
5 years ago

alopeyk-map

Mapbox wrapper for React-native

Getting started

$ npm install alopeyk-map --save

Mostly automatic installation

$ react-native link alopeyk-map

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]

  2. Go to node_modulesalopeyk-map and add Map.xcodeproj

  3. In XCode, in the project navigator, select your project. Add libMap.a to your project's Build PhasesLink Binary With Libraries

  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.alopeyk.nativemodule.map.MapPackage; to the imports at the top of the file

  • Add new MapPackage() to the list returned by the getPackages() method

  1. Append the following lines to android/settings.gradle:
include ':alopeyk-map'

project(':alopeyk-map').projectDir = new File(rootProject.projectDir, '../node_modules/alopeyk-map/android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
compile project(':alopeyk-map')
  1. Optional Add following line to MainApplication.onCreate (Also you can set Access_token on JS):
MapManager.init(getApplicationContext(), "MY_ACCESS_TOKEN");

Usage

import {Map, MapView, Marker, Picker} from  'alopeyk-map';

Map.setAccessToken('MY_TOKEN');

<MapView /> Component API

<Marker /> Component API

<Picker /> Component API

Render map with specific centerCoordinate

<MapView
    centerCoordinate={{
      lat: 37.78825,
      lng: 51.4324,
    }}
  />

Render map with multiple Markers

<MapView>
  <Marker coordinate={{lat: 35.7187515, lng: 51.390037}} shouldBound={true}/>
  <Marker coordinate={{lat: 35.7187515, lng: 51.390037}} shouldBound={true}/>
  <Marker coordinate={{lat: 35.753058, lng: 51.193853}} />
</MapView>

Custom Marker

<Marker coordinate={{lat: 35.7187515, lng: 51.390037}}>
	<Image source={ require( './assets/images/ic_location.png' ) } />
</Marker>

Render map with Picker

<MapView>
  <Picker
	  onPress={ e => {console.log('Picker@onPress', e)} }
	  onLongPress={ e => {console.log('Picker@onLongPress', e)} }/>
</MapView>

Render map with custom Picker

<MapView>
  <Picker>
	<Image source={ require( './assets/images/picker.png' ) } />
  </Picker>
</MapView>
1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago