mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-27 11:01:13 +00:00
Upgrade to 3.1.0
This commit is contained in:
+1
-24
@@ -30,30 +30,7 @@ node_modules/
|
||||
npm-debug.log
|
||||
|
||||
# project specific
|
||||
libMapboxGL.a
|
||||
MapboxGL.bundle/
|
||||
MapboxGL.h
|
||||
MGLAnnotation.h
|
||||
MGLMapboxEvents.h
|
||||
MGLMapView+IBAdditions.h
|
||||
MGLMapView.h
|
||||
MGLMetricsLocationManager.h
|
||||
MGLTypes.h
|
||||
MGLUserLocation.h
|
||||
MGLAccountManager.h
|
||||
MGLMapView_Private.h
|
||||
ios/RCTMapboxGL/MGLAnnotationImage.h
|
||||
ios/RCTMapboxGL/MGLGeometry.h
|
||||
ios/RCTMapboxGL/MGLMapCamera.h
|
||||
ios/RCTMapboxGL/MGLMultiPoint.h
|
||||
ios/RCTMapboxGL/MGLOverlay.h
|
||||
ios/RCTMapboxGL/MGLPointAnnotation.h
|
||||
ios/RCTMapboxGL/MGLPolygon.h
|
||||
ios/RCTMapboxGL/MGLPolyline.h
|
||||
ios/RCTMapboxGL/MGLShape.h
|
||||
ios/RCTMapboxGL/Mapbox.bundle/
|
||||
ios/RCTMapboxGL/Mapbox.h
|
||||
ios/RCTMapboxGL/libMapbox.a
|
||||
ios/Mapbox.framework
|
||||
android/build/
|
||||
android/.gradle/
|
||||
android/.idea/
|
||||
|
||||
+2
-1
@@ -128,7 +128,8 @@ var MapView = React.createClass({
|
||||
onFinishLoadingMap: React.PropTypes.func,
|
||||
onStartLoadingMap: React.PropTypes.func,
|
||||
onLocateUserFailed: React.PropTypes.func,
|
||||
onLongPress: React.PropTypes.func
|
||||
onLongPress: React.PropTypes.func,
|
||||
contentInset: React.PropTypes.array
|
||||
},
|
||||
getDefaultProps() {
|
||||
return {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
| `attributionButtonIsHidden` | `bool` | Optional | `false` | Whether attribution button is visible in lower right corner. *If true you must still attribute OpenStreetMap in your app. [Ref](https://www.mapbox.com/about/maps/)* |
|
||||
| `logoIsHidden` | `bool` | Optional | `false` | Whether logo is visible in lower left corner. |
|
||||
| `compassIsHidden` | `bool` | Optional | `false` | Whether compass is visible when map is rotated. |
|
||||
| `contentInset` | `array` | Optional | `[0, 0, 0, 0]` | Change the center point of the map. Offset is in pixels. `[top, right, bottom, left]`
|
||||
|
||||
## Event listeners
|
||||
|
||||
|
||||
@@ -7,12 +7,11 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
C5AF3B8C1C5A8C3D0003BF64 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5AF3B8B1C5A8C3D0003BF64 /* Mapbox.framework */; };
|
||||
C5DBB3441AF2EF2B00E611A9 /* RCTMapboxGL.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = C5DBB3431AF2EF2B00E611A9 /* RCTMapboxGL.h */; };
|
||||
C5DBB3461AF2EF2B00E611A9 /* RCTMapboxGL.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DBB3451AF2EF2B00E611A9 /* RCTMapboxGL.m */; };
|
||||
C5DBB34C1AF2EF2B00E611A9 /* libRCTMapboxGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C5DBB3401AF2EF2B00E611A9 /* libRCTMapboxGL.a */; };
|
||||
C5DBB3661AF2EFB500E611A9 /* RCTMapboxGLManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C5DBB3651AF2EFB500E611A9 /* RCTMapboxGLManager.m */; };
|
||||
C5DBB3961AF3361700E611A9 /* libMapbox.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C5DBB38C1AF3361700E611A9 /* libMapbox.a */; };
|
||||
C5DBB3A61AF338ED00E611A9 /* Mapbox.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = C5DBB38D1AF3361700E611A9 /* Mapbox.bundle */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -32,7 +31,6 @@
|
||||
dstPath = "include/$(PRODUCT_NAME)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
C5DBB3A61AF338ED00E611A9 /* Mapbox.bundle in CopyFiles */,
|
||||
C5DBB3441AF2EF2B00E611A9 /* RCTMapboxGL.h in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
@@ -40,6 +38,7 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
C5AF3B8B1C5A8C3D0003BF64 /* Mapbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Mapbox.framework; sourceTree = "<group>"; };
|
||||
C5DBB3401AF2EF2B00E611A9 /* libRCTMapboxGL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTMapboxGL.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C5DBB3431AF2EF2B00E611A9 /* RCTMapboxGL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTMapboxGL.h; sourceTree = "<group>"; };
|
||||
C5DBB3451AF2EF2B00E611A9 /* RCTMapboxGL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTMapboxGL.m; sourceTree = "<group>"; };
|
||||
@@ -47,14 +46,6 @@
|
||||
C5DBB3511AF2EF2B00E611A9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
C5DBB3641AF2EFB500E611A9 /* RCTMapboxGLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMapboxGLManager.h; sourceTree = "<group>"; };
|
||||
C5DBB3651AF2EFB500E611A9 /* RCTMapboxGLManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMapboxGLManager.m; sourceTree = "<group>"; };
|
||||
C5DBB38C1AF3361700E611A9 /* libMapbox.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libMapbox.a; sourceTree = "<group>"; };
|
||||
C5DBB38D1AF3361700E611A9 /* Mapbox.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Mapbox.bundle; sourceTree = "<group>"; };
|
||||
C5DBB38E1AF3361700E611A9 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mapbox.h; sourceTree = "<group>"; };
|
||||
C5DBB38F1AF3361700E611A9 /* MGLAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotation.h; sourceTree = "<group>"; };
|
||||
C5DBB3911AF3361700E611A9 /* MGLMapView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapView.h; sourceTree = "<group>"; };
|
||||
C5DBB3921AF3361700E611A9 /* MGLMapView+IBAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLMapView+IBAdditions.h"; sourceTree = "<group>"; };
|
||||
C5DBB3941AF3361700E611A9 /* MGLTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLTypes.h; sourceTree = "<group>"; };
|
||||
C5DBB3951AF3361700E611A9 /* MGLUserLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLUserLocation.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -62,7 +53,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C5DBB3961AF3361700E611A9 /* libMapbox.a in Frameworks */,
|
||||
C5AF3B8C1C5A8C3D0003BF64 /* Mapbox.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -80,6 +71,7 @@
|
||||
C5DBB3371AF2EF2B00E611A9 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C5AF3B8B1C5A8C3D0003BF64 /* Mapbox.framework */,
|
||||
C5DBB3421AF2EF2B00E611A9 /* RCTMapboxGL */,
|
||||
C5DBB34F1AF2EF2B00E611A9 /* RCTMapboxGLTests */,
|
||||
C5DBB3411AF2EF2B00E611A9 /* Products */,
|
||||
@@ -98,14 +90,6 @@
|
||||
C5DBB3421AF2EF2B00E611A9 /* RCTMapboxGL */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C5DBB38C1AF3361700E611A9 /* libMapbox.a */,
|
||||
C5DBB38D1AF3361700E611A9 /* Mapbox.bundle */,
|
||||
C5DBB38E1AF3361700E611A9 /* Mapbox.h */,
|
||||
C5DBB38F1AF3361700E611A9 /* MGLAnnotation.h */,
|
||||
C5DBB3911AF3361700E611A9 /* MGLMapView.h */,
|
||||
C5DBB3921AF3361700E611A9 /* MGLMapView+IBAdditions.h */,
|
||||
C5DBB3941AF3361700E611A9 /* MGLTypes.h */,
|
||||
C5DBB3951AF3361700E611A9 /* MGLUserLocation.h */,
|
||||
C5DBB3431AF2EF2B00E611A9 /* RCTMapboxGL.h */,
|
||||
C5DBB3451AF2EF2B00E611A9 /* RCTMapboxGL.m */,
|
||||
C5DBB3641AF2EFB500E611A9 /* RCTMapboxGLManager.h */,
|
||||
@@ -277,7 +261,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -314,7 +298,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
@@ -325,6 +309,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ENABLE_BITCODE = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/../node_modules/react-native/React/**",
|
||||
@@ -346,6 +334,10 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ENABLE_BITCODE = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
||||
"$(SRCROOT)/../node_modules/react-native/React/**",
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
// Copyright (c) 2015 Mapbox. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Mapbox.h"
|
||||
#import "MGLMapView.h"
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import "RCTView.h"
|
||||
#import "RCTEventDispatcher.h"
|
||||
#import "RCTBridgeModule.h"
|
||||
@@ -44,6 +43,7 @@
|
||||
- (double)zoomLevel;
|
||||
- (double)direction;
|
||||
- (CLLocationCoordinate2D)centerCoordinate;
|
||||
- (void)setContentInset:(UIEdgeInsets)inset;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
BOOL _attributionButton;
|
||||
BOOL _logo;
|
||||
BOOL _compass;
|
||||
UIEdgeInsets _inset;
|
||||
}
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
@@ -81,6 +82,7 @@ RCT_EXPORT_MODULE();
|
||||
[_map.attributionButton setHidden:_attributionButton];
|
||||
[_map.logoView setHidden:_logo];
|
||||
[_map.compassView setHidden:_compass];
|
||||
_map.contentInset = _inset;
|
||||
} else {
|
||||
/* We need to have a height/width specified in order to render */
|
||||
if (_accessToken && _styleURL && self.bounds.size.height > 0 && self.bounds.size.width > 0) {
|
||||
@@ -381,6 +383,12 @@ RCT_EXPORT_MODULE();
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setContentInset:(UIEdgeInsets)inset
|
||||
{
|
||||
_inset = inset;
|
||||
[self updateMap];
|
||||
}
|
||||
|
||||
- (void)removeAllAnnotations
|
||||
{
|
||||
NSUInteger keyCount = [_annotations count];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import "RCTMapboxGLManager.h"
|
||||
#import "RCTMapboxGL.h"
|
||||
#import "Mapbox.h"
|
||||
#import <Mapbox/Mapbox.h>
|
||||
#import "RCTConvert+CoreLocation.h"
|
||||
#import "RCTConvert+MapKit.h"
|
||||
#import "RCTBridge.h"
|
||||
@@ -133,6 +133,16 @@ RCT_CUSTOM_VIEW_PROPERTY(annotations, CLLocationCoordinate2D, RCTMapboxGL) {
|
||||
}
|
||||
}
|
||||
|
||||
RCT_CUSTOM_VIEW_PROPERTY(contentInset, UIEdgeInsetsMake, RCTMapboxGL)
|
||||
{
|
||||
int top = [json[0] intValue];
|
||||
int left = [json[3] intValue];
|
||||
int bottom = [json[2] intValue];
|
||||
int right = [json[1] intValue];
|
||||
UIEdgeInsets inset = UIEdgeInsetsMake((CGFloat)top, (CGFloat)left, (CGFloat)bottom, (CGFloat)right);
|
||||
[view setContentInset:inset];
|
||||
}
|
||||
|
||||
RCT_CUSTOM_VIEW_PROPERTY(attributionButtonIsHidden, BOOL, RCTMapboxGL)
|
||||
{
|
||||
BOOL value = [json boolValue];
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Title</key>
|
||||
<string>Privacy Settings</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
<key>FooterText</key>
|
||||
<string>This setting allows the application to share anonymized location and usage data with Mapbox.</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<true/>
|
||||
<key>Key</key>
|
||||
<string>MGLMapboxMetricsEnabled</string>
|
||||
<key>Title</key>
|
||||
<string>Mapbox Metrics</string>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>TrueValue</key>
|
||||
<true/>
|
||||
<key>FalseValue</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</array>
|
||||
<key>StringsTable</key>
|
||||
<string>Root</string>
|
||||
</dict>
|
||||
</plist>
|
||||
+19
-19
@@ -1,21 +1,21 @@
|
||||
# Manual installation process
|
||||
|
||||
1. `npm install react-native-mapbox-gl --save`
|
||||
2. In the XCode's `Project navigator`, right click on project's name ➜ `Add Files to <...>` 
|
||||
3. Add `node_modules/react-native-mapbox-gl/ios/RCTMapboxGL.xcodeproj` 
|
||||
4. Select your project in the `Project navigator`. Click `Build Phases` then `Link Binary With Libraries`. Add `node_modules/react-native-mapbox-gl/ios/RCTMapboxGL/libRCTMapboxGL.a` 
|
||||
5. Select your project in the `Project navigator`. Click `Build Phases` then `Copy Bundle Resources`. Click the `+` button. When the modal appears, click `Add other`. Add `node_modules/react-native-mapbox-gl/ios/RCTMapboxGL/Mapbox.bundle`. 
|
||||
6. Just like in the last step, select your project in the `Project navigator`. Click `Build Phases` then `Copy Bundle Resources`. Click the `+` button. When the modal appears, click `Add other`. Add `node_modules/react-native-mapbox-gl/ios/RCTMapboxGL/Settings.bundle`. [More information on location metrics can be found here](https://www.mapbox.com/mapbox-gl-ios/#metrics_opt_out).
|
||||
7. Add the following Cocoa framework dependencies to your target's Link Binary With Libraries build phase:
|
||||
* `CoreTelephony.framework`
|
||||
* `GLKit.framework`
|
||||
* `ImageIO.framework`
|
||||
* `MobileCoreServices.framework`
|
||||
* `QuartzCore.framework`
|
||||
* `SystemConfiguration.framework`
|
||||
* `libc++.tbd`
|
||||
* `libsqlite3.tbd`
|
||||
* `libz.tbd`
|
||||
* 
|
||||
8. Click on the `RCTMapboxGL` project. Under the `Build Settings` tab, search for `header_search_path`. Make sure `$(SRCROOT)/../../../React` and `$(SRCROOT)/../../react-native/React` are added and set to `recursive`. 
|
||||
9. You can now `require('react-native-mapbox-gl')` and build.
|
||||
_Make sure to follow these directions carefully._
|
||||
|
||||
First,
|
||||
```bash
|
||||
npm install react-native-mapbox-gl --save
|
||||
```
|
||||
|
||||
1. In the XCode's `Project navigator`, right click on project's name ➜ `Add Files to <...>`. Add `node_modules/react-native-mapbox-gl/ios/RCTMapboxGL.xcodeproj` 
|
||||
1. Select your project in the `Project navigator`. Click `General` tab then add `node_modules/react-native-mapbox-gl/ios/Mapbox.framework` to `Embedded Libraries`. :collision: **Important, make sure you're adding it to general -> `Embedded Libraries` :collision:** 
|
||||
1. In the `Build Phases` tab, click the plus sign and then `New Run Script Phase` 
|
||||
1. Open the newly added `Run Script` and paste (Only necessary when submitting to the app store, but a good idea to add this now):
|
||||
```bash
|
||||
bash
|
||||
"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mapbox.framework/strip-frameworks.sh"
|
||||
```
|
||||

|
||||
1. In `Build Phases` tab, click `Link Binaries With Libraries` and add `libRCTMapboxGL.a`
|
||||

|
||||
1. Add to project, [see example](./example.js)
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
"url": "https://github.com/mapbox/react-native-mapbox-gl"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "./scripts/download-mapbox-gl-native-ios.sh 3.0.0",
|
||||
"preinstall": "./scripts/download-mapbox-gl-native-ios.sh 3.1.0-pre.2",
|
||||
"test": "npm run lint",
|
||||
"lint": "eslint --no-eslintrc -c .eslintrc index.ios.js index.android.js ios/example.js android/example.js",
|
||||
"start": "node_modules/react-native/packager/packager.sh"
|
||||
|
||||
@@ -8,20 +8,9 @@ cd ios/
|
||||
if ! which curl > /dev/null; then echo "curl command not found. Please install curl"; exit 1; fi;
|
||||
if ! which unzip > /dev/null; then echo "unzip command not found. Please install unzip"; exit 1; fi;
|
||||
|
||||
if [ ! -d temp ]; then
|
||||
mkdir temp
|
||||
fi
|
||||
|
||||
if [ -d ./RCTMapboxGL/Mapbox.bundle ]; then
|
||||
rm -r RCTMapboxGL/Mapbox.bundle
|
||||
fi
|
||||
|
||||
mkdir RCTMapboxGL/Mapbox.bundle
|
||||
|
||||
curl -sS https://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/mapbox-ios-sdk-$VERSION.zip > temp.zip
|
||||
unzip -o temp.zip -d temp
|
||||
mv temp/libMapbox.a ./RCTMapboxGL
|
||||
mv temp/Headers/* ./RCTMapboxGL
|
||||
mv temp/Mapbox.bundle/* ./RCTMapboxGL/Mapbox.bundle
|
||||
mv temp/dynamic/Mapbox.framework ./Mapbox.framework
|
||||
rm -r temp
|
||||
rm temp.zip
|
||||
|
||||
Reference in New Issue
Block a user