Skip to content

Commit dcfd571

Browse files
committed
merge to master
2 parents 105c423 + 3d5438e commit dcfd571

File tree

15 files changed

+413
-135
lines changed

15 files changed

+413
-135
lines changed

.eslintrc.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
module.exports = {
2+
"parser": "babel-eslint",
3+
"plugins": [
4+
"react",
5+
"react-native",
6+
"prettier",
7+
"fp",
8+
"flowtype",
9+
],
10+
"env": {
11+
"jest": true
12+
},
13+
"settings": {
14+
"react": {
15+
"version": require('./package.json').dependencies.react,
16+
},
17+
"import/resolver": {
18+
"node": {
19+
"extensions": [
20+
".js",
21+
".jsx"
22+
]
23+
}
24+
},
25+
"react": {
26+
"pragma": "React",
27+
"version": "16.6.1",
28+
"flowVersion": "0.87"
29+
},
30+
"parserOptions": {
31+
"ecmaFeatures": {
32+
"jsx": true,
33+
"modules": true
34+
}
35+
}
36+
},
37+
"globals": {
38+
"fetch": true,
39+
"FormData": true,
40+
"requestAnimationFrame": true,
41+
"cancelAnimationFrame": true,
42+
"WebSocket": true,
43+
"__DEV__": true,
44+
"window": true,
45+
"document": true,
46+
"navigator": true,
47+
"XMLSerializer": true,
48+
},
49+
"extends": [
50+
"eslint:recommended",
51+
"plugin:react/recommended",
52+
"airbnb-base",
53+
"prettier",
54+
"plugin:flowtype/recommended"
55+
],
56+
"rules": {
57+
"react/no-deprecated": "error",
58+
"import/named": [2],
59+
"import/no-named-default": [0],
60+
"import/order": ["error", { "groups": ["builtin", "external", "parent", "sibling", "index"], "newlines-between": "always" }],
61+
"import/exports-last": [0],
62+
"import/no-useless-path-segments": [2],
63+
"camelcase": [0],
64+
"no-console": [0],
65+
"import/prefer-default-export": "off",
66+
"jsx-a11y/href-no-hash": "off",
67+
"react/prop-types": [2],
68+
"quotes": [2, "single"],
69+
"eol-last": [0],
70+
"no-continue": [1],
71+
"class-methods-use-this": [1],
72+
"no-bitwise": [1],
73+
"prefer-destructuring": [1],
74+
"consistent-return": [1],
75+
"no-warning-comments": [2],
76+
"no-mixed-requires": [0],
77+
"no-return-assign": 0,
78+
"no-underscore-dangle": [0],
79+
"no-await-in-loop": 0,
80+
"no-restricted-syntax": 0,
81+
"no-use-before-define": ["error", { "functions": false }],
82+
"no-unused-expressions": ["error", { "allowTaggedTemplates": true }],
83+
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
84+
"prettier/prettier": [
85+
"error",
86+
{
87+
"singleQuote": true,
88+
"trailingComma": "all",
89+
"bracketSpacing": false
90+
}
91+
],
92+
"fp/no-mutating-methods": "warn"
93+
}
94+
};

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ typings/
7777
android/rctmgl/build
7878
ios/ios
7979
ios/Mapbox.framework
80-
.idea/
80+
.idea/

.travis.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
matrix:
2+
include:
3+
- language: android
4+
jdk: oraclejdk8
5+
before_install:
6+
- nvm install 8
7+
- echo yes | sdkmanager "platforms;android-28"
8+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.16.0
9+
- export PATH=$HOME/.yarn/bin:$PATH
10+
android:
11+
components:
12+
- tools
13+
- platform-tools
14+
- build-tools-28.0.3
15+
- tools
16+
cache:
17+
bundler: true
18+
yarn: true
19+
directories:
20+
- example/node_modules
21+
- $HOME/.gradle/caches/
22+
- $HOME/.gradle/wrapper/
23+
before_cache:
24+
- rm -f example/node_modules/\@react-native-mapbox-gl/
25+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
26+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
27+
- os: osx
28+
osx_image: xcode10.2
29+
node_js: 8
30+
cache:
31+
bundler: true
32+
yarn: true
33+
cocoapods: true
34+
directories:
35+
- example/node_modules
36+
- $HOME/Library/Caches/Homebrew
37+
before_cache:
38+
- rm -f example/node_modules/\@react-native-mapbox-gl/
39+
- brew cleanup
40+
podfile: example/ios/Podfile
41+
42+
before_install:
43+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.16.0
44+
- export PATH=$HOME/.yarn/bin:$PATH
45+
46+
install:
47+
- cd $TRAVIS_BUILD_DIR/example
48+
- echo $MAPBOX_ACCESS_TOKEN > ./accesstoken
49+
- find node_modules -name ".git" -exec rm -r "{}" \; || true
50+
- rm -rf example/node_modules/\@react-native-mapbox-gl/
51+
- yarn install
52+
- echo $TRAVIS_OS_NAME
53+
- |
54+
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
55+
cd $TRAVIS_BUILD_DIR/example/ios
56+
pod install
57+
pod update
58+
gem install xcpretty
59+
fi
60+
script:
61+
- |
62+
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
63+
cd $TRAVIS_BUILD_DIR/example/ios
64+
set -o pipefail
65+
rm -f build
66+
xcodebuild -arch x86_64 -sdk iphonesimulator12.2 -workspace ./RNMapboxGLExample.xcworkspace -scheme RNMapboxGLExample | xcpretty -c
67+
fi
68+
- |
69+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
70+
cd $TRAVIS_BUILD_DIR/example/android
71+
TERM=dumb ./gradlew assemble
72+
fi
73+
- cd $TRAVIS_BUILD_DIR
74+
- yarn global add -g 'jest@24.8.0'
75+
- yarn install
76+
- yarn run unittest
77+
deploy:
78+
provider: npm
79+
email: kristfallro@gmail.com
80+
api_key:
81+
secure: B2hTPnT+8dWEbpBc8c2/8rwlmha8iVkRXzj88W+bgsg3k1c+tX+fNTJtbHqtahMuLfkBn6iSxfL9Bv70pXUSkdjyArlE7QdddzMx6UOO9vjoReuh1lyWNTHDx2u9iOSFYX1zsEJrf6wXkfhAtrBqF/tg2pu2NdHcaTy9grhPGnQgFpVCYKrQ67uoursqavd0nUiXVAteLH12zo0Nn1LhchogWA6CZPzz5PNgOv/KuiGIt/fmcg/Y7nlwI5BL0R29MmTIDR33tP509lFwyFTgqY/Xv4jWy0Miw+r0WQFYllkncj6dpuJ7FTdmOMfwL5vJX7B+kpZAtiBlXWtuIetRAfa/1KIWqeSIAYZTNFoEOymOXQM6DWklB3guGkAMnXNZslUvUevPzAY4SUL5fcoD+3FO8H4VAm328+hCtQWkyZbNLrU4X1FHd3BVY19YiHONHLGND9jzyzM/z0JocV0VG5azaIpPQDFVOjxhrWzTMAgwA+hNKtvQJegXIbW/sQJp12zPLv0dHJuIKjwXrnQtlSdr8JResHPFcLScuAWJ4QTSU2khcn0Ul5RnhCSGD3ic45nt46AzABqBhD6rMLesH+gbJ/i9v3LbiU7+r5JSTPfZ4ntJs168AeXy27hnWck54OjKIHp6JZ25jbJwTRCEZH1i7ETYKcheyTRR4sDiUxI=
82+
on:
83+
tags: true
84+
repo: react-native-mapbox-gl/maps
85+
branch: master

README.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# Mapbox Maps SDK for React Native
1+
# Mapir SDK for React Native
22

3-
_An unofficial React Native library for building maps with the [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/) and [Mapbox Maps SDK for Android](https://www.mapbox.com/android-sdk/)_
4-
5-
[![npm version](https://badge.fury.io/js/%40react-native-mapbox-gl%2Fmaps.svg)](https://badge.fury.io/js/%40react-native-mapbox-gl%2Fmaps)
6-
![build_status](https://travis-ci.org/react-native-mapbox-gl/maps.svg?branch=master)
7-
[![Depfu](https://badges.depfu.com/badges/2eac6b62372619718b7f55ebbf8e9d8f/overview.svg)](https://depfu.com/github/react-native-mapbox-gl/maps?project_id=8248)
3+
[![npm version](https://badge.fury.io/js/mapir-mapbox.svg)](https://badge.fury.io/js/mapir-mapbox.svg)
4+
_A React Native library for building maps with the [Mapbox Maps SDK for iOS](https://www.mapbox.com/ios-sdk/) and [Mapbox Maps SDK for Android](https://www.mapbox.com/android-sdk/)_
85

96
## Installation
107

@@ -42,33 +39,23 @@ npm install @react-native-mapbox-gl/maps --save
4239

4340
### Components
4441
* [MapView](/docs/MapView.md)
45-
* [Light](/docs/Light.md)
46-
* [StyleSheet](/docs/StyleSheet.md)
47-
* [PointAnnotation](/docs/PointAnnotation.md)
48-
* [Callout](/docs/Callout.md)
42+
* [Marker](/docs/PointAnnotation.md)
43+
* [Popup](/docs/Callout.md)
4944
* [Camera](docs/Camera.md)
5045
* [UserLocation](docs/UserLocation.md)
5146
* [Images](docs/Images.md)
5247

5348
### Sources
54-
* [VectorSource](/docs/VectorSource.md)
5549
* [ShapeSource](/docs/ShapeSource.md)
5650
* [RasterSource](/docs/RasterSource.md)
5751

5852
### Layers
59-
* [BackgroundLayer](/docs/BackgroundLayer.md)
60-
* [CircleLayer](/docs/CircleLayer.md)
61-
* [FillExtrusionLayer](/docs/FillExtrusionLayer.md)
6253
* [FillLayer](/docs/FillLayer.md)
6354
* [LineLayer](/docs/LineLayer.md)
6455
* [RasterLayer](/docs/RasterLayer.md)
6556
* [SymbolLayer](/docs/SymbolLayer.md)
6657
* [HeatmapLayer](/docs/HeatmapLayer.md)
6758

68-
### Offline
69-
* [OfflineManager](/docs/OfflineManager.md)
70-
* [SnapshotManager](/docs/snapshotManager.md)
71-
7259
## Expo Support
7360
We have a feature request open with Expo if you want to see it get in show your support https://expo.canny.io/feature-requests/p/add-mapbox-gl-support
7461

android/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Include project, so gradle knows where to find the project
6868
rootProject.name = <YOUR_PROJECT_NAME>
6969

7070
+include ':@react-native-mapbox-gl_maps'
71-
+project(':@react-native-mapbox-gl_maps').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-mapbox-gl/maps/android/rctmgl')
71+
+project(':@react-native-mapbox-gl_maps').projectDir = new File(rootProject.projectDir, '../node_modules/mapir-mapbox/android/rctmgl')
7272

7373
include ':app'¬
7474
```

docs/Camera.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
## <Mapir.Camera />
2+
###
3+
4+
### props
5+
| Prop | Type | Default | Required | Description |
6+
| ---- | :--: | :-----: | :------: | :----------: |
7+
| animationDuration | `number` | `2000` | `false` | FIX ME NO DESCRIPTION |
8+
| animationMode | `enum` | `'easeTo'` | `false` | FIX ME NO DESCRIPTION |
9+
| defaultSettings | `shape` | `none` | `false` | FIX ME NO DESCRIPTION |
10+
| &nbsp;&nbsp;centerCoordinate | `array` | `none` | `false` | Center coordinate on map [lng, lat] |
11+
| &nbsp;&nbsp;heading | `number` | `none` | `false` | Heading on map |
12+
| &nbsp;&nbsp;pitch | `number` | `none` | `false` | Pitch on map |
13+
| &nbsp;&nbsp;bounds | `shape` | `none` | `false` | FIX ME NO DESCRIPTION |
14+
| &nbsp;&nbsp;&nbsp;&nbsp;ne | `array` | `none` | `true` | northEastCoordinates - North east coordinate of bound |
15+
| &nbsp;&nbsp;&nbsp;&nbsp;sw | `array` | `none` | `true` | southWestCoordinates - North east coordinate of bound |
16+
| &nbsp;&nbsp;&nbsp;&nbsp;paddingLeft | `number` | `none` | `false` | Left camera padding for bounds |
17+
| &nbsp;&nbsp;&nbsp;&nbsp;paddingRight | `number` | `none` | `false` | Right camera padding for bounds |
18+
| &nbsp;&nbsp;&nbsp;&nbsp;paddingTop | `number` | `none` | `false` | Top camera padding for bounds |
19+
| &nbsp;&nbsp;&nbsp;&nbsp;paddingBottom | `number` | `none` | `false` | Bottom camera padding for bounds |
20+
| &nbsp;&nbsp;zoomLevel | `number` | `none` | `false` | Zoom level of the map |
21+
| centerCoordinate | `array` | `none` | `false` | Center coordinate on map [lng, lat] |
22+
| heading | `number` | `none` | `false` | Heading on map |
23+
| pitch | `number` | `none` | `false` | Pitch on map |
24+
| bounds | `shape` | `none` | `false` | FIX ME NO DESCRIPTION |
25+
| &nbsp;&nbsp;ne | `array` | `none` | `true` | northEastCoordinates - North east coordinate of bound |
26+
| &nbsp;&nbsp;sw | `array` | `none` | `true` | southWestCoordinates - North east coordinate of bound |
27+
| &nbsp;&nbsp;paddingLeft | `number` | `none` | `false` | Left camera padding for bounds |
28+
| &nbsp;&nbsp;paddingRight | `number` | `none` | `false` | Right camera padding for bounds |
29+
| &nbsp;&nbsp;paddingTop | `number` | `none` | `false` | Top camera padding for bounds |
30+
| &nbsp;&nbsp;paddingBottom | `number` | `none` | `false` | Bottom camera padding for bounds |
31+
| zoomLevel | `number` | `none` | `false` | Zoom level of the map |
32+
| minZoomLevel | `number` | `none` | `false` | FIX ME NO DESCRIPTION |
33+
| maxZoomLevel | `number` | `none` | `false` | FIX ME NO DESCRIPTION |
34+
| followUserLocation | `bool` | `none` | `false` | FIX ME NO DESCRIPTION |
35+
| followUserMode | `enum` | `none` | `false` | FIX ME NO DESCRIPTION |
36+
| followZoomLevel | `number` | `none` | `false` | FIX ME NO DESCRIPTION |
37+
| followPitch | `number` | `none` | `false` | FIX ME NO DESCRIPTION |
38+
| followHeading | `number` | `none` | `false` | FIX ME NO DESCRIPTION |
39+
| triggerKey | `any` | `none` | `false` | FIX ME NO DESCRIPTION |
40+
| alignment | `array` | `none` | `false` | FIX ME NO DESCRIPTION |
41+
| isUserInteraction | `FIX ME UNKNOWN TYPE` | `false` | `false` | FIX ME NO DESCRIPTION |
42+
43+
### methods
44+
#### fitBounds(northEastCoordinates, southWestCoordinates[, padding][, animationDuration])
45+
46+
Map camera transitions to fit provided bounds
47+
48+
##### arguments
49+
| Name | Type | Required | Description |
50+
| ---- | :--: | :------: | :----------: |
51+
| `northEastCoordinates` | `Array` | `Yes` | North east coordinate of bound |
52+
| `southWestCoordinates` | `Array` | `Yes` | South west coordinate of bound |
53+
| `padding` | `Number` | `No` | Camera padding for bound |
54+
| `animationDuration` | `Number` | `No` | Duration of camera animation |
55+
56+
57+
58+
```javascript
59+
this.camera.fitBounds([lng, lat], [lng, lat])
60+
this.camera.fitBounds([lng, lat], [lng, lat], 20, 1000) // padding for all sides
61+
this.camera.fitBounds([lng, lat], [lng, lat], [verticalPadding, horizontalPadding], 1000)
62+
this.camera.fitBounds([lng, lat], [lng, lat], [top, right, bottom, left], 1000)
63+
```
64+
65+
66+
#### flyTo(coordinates[, animationDuration])
67+
68+
Map camera will fly to new coordinate
69+
70+
##### arguments
71+
| Name | Type | Required | Description |
72+
| ---- | :--: | :------: | :----------: |
73+
| `coordinates` | `Array` | `Yes` | Coordinates that map camera will jump too |
74+
| `animationDuration` | `Number` | `No` | Duration of camera animation |
75+
76+
77+
78+
```javascript
79+
this.camera.flyTo([lng, lat])
80+
this.camera.flyTo([lng, lat], 12000)
81+
```
82+
83+
84+
#### moveTo(coordinates[, animationDuration])
85+
86+
Map camera will move to new coordinate at the same zoom level
87+
88+
##### arguments
89+
| Name | Type | Required | Description |
90+
| ---- | :--: | :------: | :----------: |
91+
| `coordinates` | `Array` | `Yes` | Coordinates that map camera will move too |
92+
| `animationDuration` | `Number` | `No` | Duration of camera animation |
93+
94+
95+
96+
```javascript
97+
this.camera.moveTo([lng, lat], 200) // eases camera to new location based on duration
98+
this.camera.moveTo([lng, lat]) // snaps camera to new location without any easing
99+
```
100+
101+
102+
#### zoomTo(zoomLevel[, animationDuration])
103+
104+
Map camera will zoom to specified level
105+
106+
##### arguments
107+
| Name | Type | Required | Description |
108+
| ---- | :--: | :------: | :----------: |
109+
| `zoomLevel` | `Number` | `Yes` | Zoom level that the map camera will animate too |
110+
| `animationDuration` | `Number` | `No` | Duration of camera animation |
111+
112+
113+
114+
```javascript
115+
this.camera.zoomTo(16)
116+
this.camera.zoomTo(16, 100)
117+
```
118+
119+
120+
#### setCamera(config)
121+
122+
Map camera will perform updates based on provided config. Advanced use only!
123+
124+
##### arguments
125+
| Name | Type | Required | Description |
126+
| ---- | :--: | :------: | :----------: |
127+
| `config` | `Object` | `Yes` | Camera configuration |
128+
129+
130+
131+
```javascript
132+
this.camera.setCamera({
133+
centerCoordinate: [lng, lat],
134+
zoomLevel: 16,
135+
animationDuration: 2000,
136+
})
137+
138+
this.camera.setCamera({
139+
stops: [
140+
{ pitch: 45, animationDuration: 200 },
141+
{ heading: 180, animationDuration: 300 },
142+
]
143+
})
144+
```
145+
146+
147+

0 commit comments

Comments
 (0)