*)lineDashPattern {
51 | _lineDashPattern = lineDashPattern;
52 | [self update];
53 | }
54 |
55 | - (void)setRadius:(CLLocationDistance)radius {
56 | _radius = radius;
57 | _radiusSet = YES;
58 | [self createCircleAndRendererIfPossible];
59 | [self update];
60 | }
61 |
62 | - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate{
63 | _centerCoordinate = centerCoordinate;
64 | _centerSet = YES;
65 | [self createCircleAndRendererIfPossible];
66 | [self update];
67 | }
68 |
69 | - (void) createCircleAndRendererIfPossible
70 | {
71 | if (!_centerSet || !_radiusSet) return;
72 | self.circle = [MKCircle circleWithCenterCoordinate:_centerCoordinate radius:_radius];
73 | self.renderer = [[MKCircleRenderer alloc] initWithCircle:self.circle];
74 | }
75 |
76 | - (void) update
77 | {
78 | if (!_renderer) return;
79 | _renderer.fillColor = _fillColor;
80 | _renderer.strokeColor = _strokeColor;
81 | _renderer.lineWidth = _strokeWidth;
82 | _renderer.lineCap = _lineCap;
83 | _renderer.lineJoin = _lineJoin;
84 | _renderer.miterLimit = _miterLimit;
85 | _renderer.lineDashPhase = _lineDashPhase;
86 | _renderer.lineDashPattern = _lineDashPattern;
87 |
88 | if (_map == nil) return;
89 | [_map removeOverlay:self];
90 | [_map addOverlay:self];
91 | }
92 |
93 |
94 | #pragma mark MKOverlay implementation
95 |
96 | - (CLLocationCoordinate2D) coordinate
97 | {
98 | return self.circle.coordinate;
99 | }
100 |
101 | - (MKMapRect) boundingMapRect
102 | {
103 | return self.circle.boundingMapRect;
104 | }
105 |
106 | - (BOOL)intersectsMapRect:(MKMapRect)mapRect
107 | {
108 | BOOL answer = [self.circle intersectsMapRect:mapRect];
109 | return answer;
110 | }
111 |
112 | - (BOOL)canReplaceMapContent
113 | {
114 | return NO;
115 | }
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 | @end
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem http://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto init
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto init
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 | @rem Execute Gradle
88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
89 |
90 | :end
91 | @rem End local scope for the variables with windows NT shell
92 | if "%ERRORLEVEL%"=="0" goto mainEnd
93 |
94 | :fail
95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
96 | rem the _cmd.exe /c_ return code!
97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
98 | exit /b 1
99 |
100 | :mainEnd
101 | if "%OS%"=="Windows_NT" endlocal
102 |
103 | :omega
104 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/java/com/example/rnosm/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.example.rnosm;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | public class ReactNativeFlipper {
28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
29 | if (FlipperUtils.shouldEnableFlipper(context)) {
30 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
31 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
32 | client.addPlugin(new ReactFlipperPlugin());
33 | client.addPlugin(new DatabasesFlipperPlugin(context));
34 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
35 | client.addPlugin(CrashReporterPlugin.getInstance());
36 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
37 | NetworkingModule.setCustomClientBuilder(
38 | new NetworkingModule.CustomClientBuilder() {
39 | @Override
40 | public void apply(OkHttpClient.Builder builder) {
41 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
42 | }
43 | });
44 | client.addPlugin(networkFlipperPlugin);
45 | client.start();
46 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
47 | // Hence we run if after all native modules have been initialized
48 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
49 | if (reactContext == null) {
50 | reactInstanceManager.addReactInstanceEventListener(
51 | new ReactInstanceManager.ReactInstanceEventListener() {
52 | @Override
53 | public void onReactContextInitialized(ReactContext reactContext) {
54 | reactInstanceManager.removeReactInstanceEventListener(this);
55 | reactContext.runOnNativeModulesQueueThread(
56 | new Runnable() {
57 | @Override
58 | public void run() {
59 | client.addPlugin(new FrescoFlipperPlugin());
60 | }
61 | });
62 | }
63 | });
64 | } else {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/docs/polyline.md:
--------------------------------------------------------------------------------
1 | # `` Component API
2 |
3 | ## Props
4 |
5 | | Prop | Type | Default | Note |
6 | |---|---|---|---|
7 | | `coordinates` | `Array` | (Required) | An array of coordinates to describe the polyline
8 | | `strokeWidth` | `Number` | `1` | The stroke width to use for the path.
9 | | `strokeColor` | `String` | `#000` | The stroke color to use for the path.
10 | | `strokeColors` | `Array` | `null` | The stroke colors to use for the path (iOS only). Must be the same length as `coordinates`.
11 | | `lineCap` | `String` | `round` | The line cap style to apply to the open ends of the path. Possible values are `butt`, `round` or `square`.
12 | | `lineJoin` | `String` | `round` | The line join style to apply to corners of the path. Possible values are `miter`, `round` or `bevel`.
13 | | `miterLimit` | `Number` | | The limiting value that helps avoid spikes at junctions between connected line segments. The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style. If the ratio of the miter length—that is, the diagonal length of the miter join—to the line thickness exceeds the miter limit, the joint is converted to a bevel join. The default miter limit is 10, which results in the conversion of miters whose angle at the joint is less than 11 degrees.
14 | | `geodesic` | `Boolean` | | Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to straight lines on the Mercator projection. A geodesic is the shortest path between two points on the Earth's surface. The geodesic curve is constructed assuming the Earth is a sphere.
15 | | `lineDashPhase` | `Number` | `0` | (iOS only) The offset (in points) at which to start drawing the dash pattern. Use this property to start drawing a dashed line partway through a segment or gap. For example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the middle of the first gap.
16 | | `lineDashPattern` | `Array` | `null` | (iOS only) An array of numbers specifying the dash pattern to use for the path. The array contains one or more numbers that indicate the lengths (measured in points) of the line segments and gaps in the pattern. The values in the array alternate, starting with the first line segment length, followed by the first gap length, followed by the second line segment length, and so on.
17 |
18 | ## Events
19 |
20 | | Event Name | Returns | Notes
21 | |---|---|---|
22 | | `onPress` | | Callback that is called when the user presses on the polyline
23 |
24 | ## Types
25 |
26 | ```
27 | type LatLng {
28 | latitude: Number,
29 | longitude: Number,
30 | }
31 | ```
32 |
33 | ## Gradient Polylines (iOS MapKit only)
34 |
35 | Gradient polylines can be created by using the `strokeColors` prop. `strokeColors` must be an array with the same number of elements as `coordinates`.
36 |
37 | Example:
38 |
39 | ```js
40 |
41 |
61 |
62 | ```
63 |
--------------------------------------------------------------------------------
/lib/ios/AirMaps/AIRMapPolygon.m:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Leland Richardson on 12/27/15.
3 | // Copyright (c) 2015 Facebook. All rights reserved.
4 | //
5 |
6 | #import "AIRMapPolygon.h"
7 | #import
8 |
9 |
10 | @implementation AIRMapPolygon {
11 |
12 | }
13 |
14 | - (void)setFillColor:(UIColor *)fillColor {
15 | _fillColor = fillColor;
16 | [self update];
17 | }
18 |
19 | - (void)setStrokeColor:(UIColor *)strokeColor {
20 | _strokeColor = strokeColor;
21 | [self update];
22 | }
23 |
24 | - (void)setStrokeWidth:(CGFloat)strokeWidth {
25 | _strokeWidth = strokeWidth;
26 | [self update];
27 | }
28 |
29 | - (void)setLineJoin:(CGLineJoin)lineJoin {
30 | _lineJoin = lineJoin;
31 | [self update];
32 | }
33 |
34 | - (void)setLineCap:(CGLineCap)lineCap {
35 | _lineCap = lineCap;
36 | [self update];
37 | }
38 |
39 | - (void)setMiterLimit:(CGFloat)miterLimit {
40 | _miterLimit = miterLimit;
41 | [self update];
42 | }
43 |
44 | - (void)setLineDashPhase:(CGFloat)lineDashPhase {
45 | _lineDashPhase = lineDashPhase;
46 | [self update];
47 | }
48 |
49 | - (void)setLineDashPattern:(NSArray *)lineDashPattern {
50 | _lineDashPattern = lineDashPattern;
51 | [self update];
52 | }
53 |
54 | - (void)setCoordinates:(NSArray *)coordinates {
55 | _coordinates = coordinates;
56 | CLLocationCoordinate2D coords[coordinates.count];
57 | for(int i = 0; i < coordinates.count; i++)
58 | {
59 | coords[i] = coordinates[i].coordinate;
60 | }
61 | self.polygon = [MKPolygon polygonWithCoordinates:coords count:coordinates.count interiorPolygons:_interiorPolygons];
62 | // TODO: we could lazy-initialize the polygon, since we don't need it until the
63 | // polygon is in view.
64 | self.renderer = [[MKPolygonRenderer alloc] initWithPolygon:self.polygon];
65 | [self update];
66 | }
67 |
68 | - (void)setHoles:(NSArray *> *)holes {
69 | _holes = holes;
70 | if (holes.count)
71 | {
72 | NSMutableArray *polygons = [NSMutableArray array];
73 | for(int h = 0; h < holes.count; h++)
74 | {
75 | CLLocationCoordinate2D coords[holes[h].count];
76 | for(int i = 0; i < holes[h].count; i++)
77 | {
78 | coords[i] = holes[h][i].coordinate;
79 | }
80 | [polygons addObject:[MKPolygon polygonWithCoordinates:coords count:holes[h].count]];
81 | }
82 | _interiorPolygons = polygons;
83 | }
84 | }
85 |
86 | - (void) update
87 | {
88 | if (!_renderer) return;
89 | _renderer.fillColor = _fillColor;
90 | _renderer.strokeColor = _strokeColor;
91 | _renderer.lineWidth = _strokeWidth;
92 | _renderer.lineCap = _lineCap;
93 | _renderer.lineJoin = _lineJoin;
94 | _renderer.miterLimit = _miterLimit;
95 | _renderer.lineDashPhase = _lineDashPhase;
96 | _renderer.lineDashPattern = _lineDashPattern;
97 |
98 | if (_map == nil) return;
99 | [_map removeOverlay:self];
100 | [_map addOverlay:self];
101 | }
102 |
103 | #pragma mark MKOverlay implementation
104 |
105 | - (CLLocationCoordinate2D) coordinate
106 | {
107 | return self.polygon.coordinate;
108 | }
109 |
110 | - (MKMapRect) boundingMapRect
111 | {
112 | return self.polygon.boundingMapRect;
113 | }
114 |
115 | - (BOOL)intersectsMapRect:(MKMapRect)mapRect
116 | {
117 | BOOL answer = [self.polygon intersectsMapRect:mapRect];
118 | return answer;
119 | }
120 |
121 | - (BOOL)canReplaceMapContent
122 | {
123 | return NO;
124 | }
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 | @end
179 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
21 |
22 | ### Is this a bug report?
23 |
24 | (write your answer here)
25 |
26 |
40 |
41 | ### Have you read the [Installation Instructions](https://github.com/react-community/react-native-maps/blob/master/docs/installation.md)?
42 |
43 | (Write your answer here.)
44 |
45 | ### Environment
46 |
47 |
60 |
61 | ### Steps to Reproduce
62 |
63 |
68 |
69 | (Write your steps here:)
70 |
71 | 1. 2. 3.
72 |
73 | ### Expected Behavior
74 |
75 |
80 |
81 | (Write what you thought would happen.)
82 |
83 | ### Actual Behavior
84 |
85 |
91 |
92 | (Write what happened. Add screenshots!)
93 |
94 | ### Reproducible Demo
95 |
96 |
109 |
110 | (Paste the link to an example project and exact instructions to reproduce the issue.)
111 |
112 |
--------------------------------------------------------------------------------
/example/ios/RnOsmExample.xcodeproj/xcshareddata/xcschemes/RnOsmExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
51 |
52 |
53 |
54 |
64 |
66 |
72 |
73 |
74 |
75 |
81 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/lib/ios/AirMaps/AIRMapPolyline.m:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Leland Richardson on 12/27/15.
3 | // Copyright (c) 2015 Facebook. All rights reserved.
4 | //
5 |
6 | #import "AIRMapPolyline.h"
7 | #import "AIRMapPolylineRenderer.h"
8 | #import
9 |
10 |
11 | @implementation AIRMapPolyline {
12 |
13 | }
14 |
15 | - (void)setFillColor:(UIColor *)fillColor {
16 | _fillColor = fillColor;
17 | [self update];
18 | }
19 |
20 | - (void)setStrokeColor:(UIColor *)strokeColor {
21 | _strokeColor = strokeColor;
22 | [self update];
23 | }
24 |
25 | - (void)setStrokeColors:(NSArray *)strokeColors {
26 | _strokeColors = strokeColors;
27 | if ((self.renderer != nil) && ![_renderer isKindOfClass:[AIRMapPolylineRenderer class]]) {
28 | self.renderer = [self createRenderer];
29 | }
30 | [self update];
31 | }
32 |
33 | - (void)setStrokeWidth:(CGFloat)strokeWidth {
34 | _strokeWidth = strokeWidth;
35 | [self update];
36 | }
37 |
38 | - (void)setLineJoin:(CGLineJoin)lineJoin {
39 | _lineJoin = lineJoin;
40 | [self update];
41 | }
42 |
43 | - (void)setLineCap:(CGLineCap)lineCap {
44 | _lineCap = lineCap;
45 | [self update];
46 | }
47 |
48 | - (void)setMiterLimit:(CGFloat)miterLimit {
49 | _miterLimit = miterLimit;
50 | [self update];
51 | }
52 |
53 | - (void)setLineDashPhase:(CGFloat)lineDashPhase {
54 | _lineDashPhase = lineDashPhase;
55 | [self update];
56 | }
57 |
58 | - (void)setLineDashPattern:(NSArray *)lineDashPattern {
59 | _lineDashPattern = lineDashPattern;
60 | [self update];
61 | }
62 |
63 | - (void)setCoordinates:(NSArray *)coordinates {
64 | _coordinates = coordinates;
65 | CLLocationCoordinate2D coords[coordinates.count];
66 | for(int i = 0; i < coordinates.count; i++)
67 | {
68 | coords[i] = coordinates[i].coordinate;
69 | }
70 | self.polyline = [MKPolyline polylineWithCoordinates:coords count:coordinates.count];
71 | self.renderer = [self createRenderer];
72 | [self update];
73 | }
74 |
75 | - (MKOverlayPathRenderer*)createRenderer {
76 | if (self.polyline == nil) return nil;
77 | if (self.strokeColors == nil) {
78 | // Use the default renderer when no array of stroke-colors is defined.
79 | // This behaviour may be changed in the future if we permanently want to
80 | // use the custom renderer, because it can add funtionality that is not
81 | // supported by the default renderer.
82 | return [[MKPolylineRenderer alloc] initWithPolyline:self.polyline];
83 | }
84 | else {
85 | return [[AIRMapPolylineRenderer alloc] initWithOverlay:self polyline:self.polyline];
86 | }
87 | }
88 |
89 | - (void) update
90 | {
91 | if (!_renderer) return;
92 | [self updateRenderer:_renderer];
93 |
94 | if (_map == nil) return;
95 | [_map removeOverlay:self];
96 | [_map addOverlay:self];
97 | }
98 |
99 | - (void) updateRenderer:(MKOverlayPathRenderer*)renderer {
100 | renderer.fillColor = _fillColor;
101 | renderer.strokeColor = _strokeColor;
102 | renderer.lineWidth = _strokeWidth;
103 | renderer.lineCap = _lineCap;
104 | renderer.lineJoin = _lineJoin;
105 | renderer.miterLimit = _miterLimit;
106 | renderer.lineDashPhase = _lineDashPhase;
107 | renderer.lineDashPattern = _lineDashPattern;
108 |
109 | if ([renderer isKindOfClass:[AIRMapPolylineRenderer class]]) {
110 | ((AIRMapPolylineRenderer*)renderer).strokeColors = _strokeColors;
111 | }
112 | }
113 |
114 | #pragma mark MKOverlay implementation
115 |
116 | - (CLLocationCoordinate2D) coordinate
117 | {
118 | return self.polyline.coordinate;
119 | }
120 |
121 | - (MKMapRect) boundingMapRect
122 | {
123 | return self.polyline.boundingMapRect;
124 | }
125 |
126 | - (BOOL)intersectsMapRect:(MKMapRect)mapRect
127 | {
128 | BOOL answer = [self.polyline intersectsMapRect:mapRect];
129 | return answer;
130 | }
131 |
132 | - (BOOL)canReplaceMapContent
133 | {
134 | return NO;
135 | }
136 |
137 |
138 | #pragma mark AIRMapSnapshot implementation
139 |
140 | - (void) drawToSnapshot:(MKMapSnapshot *) snapshot context:(CGContextRef) context
141 | {
142 | AIRMapPolylineRenderer* renderer = [[AIRMapPolylineRenderer alloc] initWithSnapshot:snapshot overlay:self polyline:self.polyline];
143 | [self updateRenderer:renderer];
144 | [renderer drawWithZoomScale:2 inContext:context];
145 | }
146 |
147 | @end
148 |
--------------------------------------------------------------------------------
/docs/marker.md:
--------------------------------------------------------------------------------
1 | # `` Component API
2 |
3 | ## Props
4 |
5 | | Prop | Type | Default | Note |
6 | |---|---|---|---|
7 | | `title` | `String` | | The title of the marker. This is only used if the component has no children that are an ``, in which case the default callout behavior will be used, which will show both the `title` and the `description`, if provided.
8 | | `description` | `String` | | The description of the marker. This is only used if the component has no children that are an ``, in which case the default callout behavior will be used, which will show both the `title` and the `description`, if provided.
9 | | `image` | `ImageSource` | | A custom image to be used as the marker's icon. Only local image resources are allowed to be used.
10 | | `pinColor` | `Color` | | If no custom marker view or custom image is provided, the platform default pin will be used, which can be customized by this color. Ignored if a custom marker is being used.
11 | | `coordinate` | `LatLng` | | The coordinate for the marker.
12 | | `centerOffset` | `Point` | | The offset (in points) at which to display the view.
By default, the center point of an annotation view is placed at the coordinate point of the associated annotation. You can use this property to reposition the annotation view as needed. This x and y offset values are measured in points. Positive offset values move the annotation view down and to the right, while negative values move it up and to the left.
For Google Maps, see the `anchor` prop.
13 | | `calloutOffset` | `Point` | | The offset (in points) at which to place the callout bubble.
This property determines the additional distance by which to move the callout bubble. When this property is set to (0, 0), the anchor point of the callout bubble is placed on the top-center point of the marker view’s frame. Specifying positive offset values moves the callout bubble down and to the right, while specifying negative values moves it up and to the left.
For android, see the `calloutAnchor` prop.
14 | | `anchor` | `Point` | | Sets the anchor point for the marker.
The anchor specifies the point in the icon image that is anchored to the marker's position on the Earth's surface.
The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0], where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner. The anchoring point in a W x H image is the nearest discrete grid point in a (W + 1) x (H + 1) grid, obtained by scaling the then rounding. For example, in a 4 x 2 image, the anchor point (0.7, 0.6) resolves to the grid point at (3, 1).
For MapKit on iOS, see the `centerOffset` prop.
15 | | `calloutAnchor` | `Point` | | Specifies the point in the marker image at which to anchor the callout when it is displayed. This is specified in the same coordinate system as the anchor. See the `anchor` prop for more details.
The default is the top middle of the image.
For ios, see the `calloutOffset` prop.
16 | | `flat` | `Boolean` | | Sets whether this marker should be flat against the map true or a billboard facing the camera false.
17 | | `identifier` | `String` | | An identifier used to reference this marker at a later date.
18 | | `rotation` | `Float` | | A float number indicating marker's rotation angle, in degrees.
19 | | `draggable` | `` | | This is a non-value based prop. Adding this allows the marker to be draggable (re-positioned).
20 |
21 | ## Events
22 |
23 | To access event data, you will need to use `e.nativeEvent`. For example, `onPress={e => console.log(e.nativeEvent)}` will log the entire event object to your console.
24 |
25 | | Event Name | Returns | Notes
26 | |---|---|---|
27 | | `onPress` | `{ coordinate: LatLng, position: Point }` | Callback that is called when the user presses on the marker
28 | | `onSelect` | `{ coordinate: LatLng, position: Point }` | Callback that is called when the user selects the marker, before the callout is shown. **Note**: iOS only.
29 | | `onDeselect` | `{ coordinate: LatLng, position: Point }` | Callback that is called when the marker is deselected, before the callout is hidden. **Note**: iOS only.
30 | | `onCalloutPress` | | Callback that is called when the user taps the callout view.
31 | | `onDragStart` | `{ coordinate: LatLng, position: Point }` | Callback that is called when the user initiates a drag on this marker (if it is draggable)
32 | | `onDrag` | `{ coordinate: LatLng, position: Point }` | Callback called continuously as the marker is dragged
33 | | `onDragEnd` | `{ coordinate: LatLng, position: Point }` | Callback that is called when a drag on this marker finishes. This is usually the point you will want to setState on the marker's coordinate again
34 |
35 |
36 | ## Methods
37 |
38 | | Method Name | Arguments | Notes
39 | |---|---|---|
40 | | `showCallout` | | Shows the callout for this marker
41 | | `hideCallout` | | Hides the callout for this marker
42 |
43 |
44 |
45 | ## Types
46 |
47 | ```
48 | type LatLng {
49 | latitude: Number,
50 | longitude: Number,
51 | }
52 | ```
53 |
54 | ```
55 | type Point {
56 | x: Number,
57 | y: Number,
58 | }
59 | ```
60 |
--------------------------------------------------------------------------------
/lib/android/src/main/java/com/airbnb/android/react/maps/open/marker/OpenAirMapMarkerManager.java:
--------------------------------------------------------------------------------
1 | package com.airbnb.android.react.maps.open.marker;
2 |
3 | import com.airbnb.android.react.maps.open.SizeReportingShadowNode;
4 | import com.facebook.react.bridge.ReadableArray;
5 | import com.facebook.react.bridge.ReadableMap;
6 | import com.facebook.react.common.MapBuilder;
7 | import com.facebook.react.uimanager.LayoutShadowNode;
8 | import com.facebook.react.uimanager.ThemedReactContext;
9 | import com.facebook.react.uimanager.ViewGroupManager;
10 | import com.facebook.react.uimanager.annotations.ReactProp;
11 | import com.google.android.gms.maps.model.Marker;
12 |
13 | import java.util.HashMap;
14 | import java.util.Map;
15 |
16 | import javax.annotation.Nullable;
17 |
18 | public class OpenAirMapMarkerManager extends ViewGroupManager {
19 |
20 | private static final int SHOW_INFO_WINDOW = 1;
21 | private static final int HIDE_INFO_WINDOW = 2;
22 |
23 | public OpenAirMapMarkerManager() {
24 | }
25 |
26 | @Override
27 | public String getName() {
28 | return "AIRMapMarker";
29 | }
30 |
31 | @Override
32 | public OpenAirMapMarker createViewInstance(ThemedReactContext context) {
33 | return new OpenAirMapMarker(context);
34 | }
35 |
36 | @ReactProp(name = "anchor")
37 | public void setAnchor(OpenAirMapMarker view, ReadableMap map) {
38 | // should default to (0.5, 1) (bottom middle)
39 | double x = map != null && map.hasKey("x") ? map.getDouble("x") : 0.5;
40 | double y = map != null && map.hasKey("y") ? map.getDouble("y") : 1.0;
41 | float xFloat = (float)x;
42 | float yFloat = (float)y;
43 |
44 | view.setY(yFloat);
45 | view.setX(xFloat);
46 | }
47 |
48 | @ReactProp(name = "calloutAnchor")
49 | public void setCalloutAnchor(OpenAirMapMarker view, ReadableMap map) {
50 | // should default to (0.5, 0) (top middle)
51 | double x = map != null && map.hasKey("x") ? map.getDouble("x") : 0.5;
52 | double y = map != null && map.hasKey("y") ? map.getDouble("y") : 0.0;
53 | float xFloat = (float)x;
54 | float yFloat = (float)y;
55 |
56 | view.setY(yFloat);
57 | view.setX(xFloat);
58 | }
59 |
60 | @ReactProp(name = "rotation", defaultFloat = 0.0f)
61 | public void setMarkerRotation(OpenAirMapMarker view, float rotation) {
62 | view.setRotation(rotation);
63 | }
64 |
65 | @ReactProp(name = "draggable", defaultBoolean = false)
66 | public void setDraggable(OpenAirMapMarker view, boolean draggable) {
67 | view.setEnabled(draggable);
68 | }
69 |
70 | @Override
71 | @Nullable
72 | public Map getCommandsMap() {
73 | return MapBuilder.of(
74 | "showCallout", SHOW_INFO_WINDOW,
75 | "hideCallout", HIDE_INFO_WINDOW
76 | );
77 | }
78 |
79 | @Override
80 | public void receiveCommand(OpenAirMapMarker view, int commandId, @Nullable ReadableArray args) {
81 | switch (commandId) {
82 | case SHOW_INFO_WINDOW:
83 | ((Marker) view.getFeature()).showInfoWindow();
84 | break;
85 |
86 | case HIDE_INFO_WINDOW:
87 | ((Marker) view.getFeature()).hideInfoWindow();
88 | break;
89 | }
90 | }
91 |
92 | @Override
93 | @Nullable
94 | public Map getExportedCustomDirectEventTypeConstants() {
95 | Map> map = MapBuilder.of(
96 | "onPress", MapBuilder.of("registrationName", "onPress"),
97 | "onCalloutPress", MapBuilder.of("registrationName", "onCalloutPress"),
98 | "onDragStart", MapBuilder.of("registrationName", "onDragStart"),
99 | "onDrag", MapBuilder.of("registrationName", "onDrag"),
100 | "onDragEnd", MapBuilder.of("registrationName", "onDragEnd")
101 | );
102 |
103 | map.putAll(MapBuilder.of(
104 | "onDragStart", MapBuilder.of("registrationName", "onDragStart"),
105 | "onDrag", MapBuilder.of("registrationName", "onDrag"),
106 | "onDragEnd", MapBuilder.of("registrationName", "onDragEnd")
107 | ));
108 |
109 | return map;
110 | }
111 |
112 | @Override
113 | public LayoutShadowNode createShadowNodeInstance() {
114 | // we use a custom shadow node that emits the width/height of the view
115 | // after layout with the updateExtraData method. Without this, we can't generate
116 | // a bitmap of the appropriate width/height of the rendered view.
117 | return new SizeReportingShadowNode();
118 | }
119 |
120 | @Override
121 | public void updateExtraData(OpenAirMapMarker view, Object extraData) {
122 | // This method is called from the shadow node with the width/height of the rendered
123 | // marker view.
124 | HashMap data = (HashMap) extraData;
125 | float width = data.get("width");
126 | float height = data.get("height");
127 |
128 | // view.update((int) width, (int) height);
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/lib/components/MapPolyline.js:
--------------------------------------------------------------------------------
1 | import PropTypes from "prop-types";
2 | import React from "react";
3 | import { ViewPropTypes, View } from "react-native";
4 | import decorateMapComponent, {
5 | USES_DEFAULT_IMPLEMENTATION,
6 | SUPPORTED,
7 | } from "./decorateMapComponent";
8 |
9 | // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
10 | const viewPropTypes = ViewPropTypes || View.propTypes;
11 |
12 | const propTypes = {
13 | ...viewPropTypes,
14 |
15 | /**
16 | * An array of coordinates to describe the polygon
17 | */
18 | coordinates: PropTypes.arrayOf(
19 | PropTypes.shape({
20 | /**
21 | * Latitude/Longitude coordinates
22 | */
23 | latitude: PropTypes.number.isRequired,
24 | longitude: PropTypes.number.isRequired,
25 | })
26 | ),
27 |
28 | /**
29 | * Callback that is called when the user presses on the polyline
30 | */
31 | onPress: PropTypes.func,
32 |
33 | /* Boolean to allow a polyline to be tappable and use the
34 | * onPress function
35 | */
36 | tappable: PropTypes.bool,
37 |
38 | /**
39 | * The fill color to use for the path.
40 | */
41 | fillColor: PropTypes.string,
42 |
43 | /**
44 | * The stroke width to use for the path.
45 | */
46 | strokeWidth: PropTypes.number,
47 |
48 | /**
49 | * The stroke color to use for the path.
50 | */
51 | strokeColor: PropTypes.string,
52 |
53 | /**
54 | * The stroke colors to use for the path.
55 | */
56 | strokeColors: PropTypes.arrayOf(PropTypes.string),
57 |
58 | /**
59 | * The order in which this tile overlay is drawn with respect to other overlays. An overlay
60 | * with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
61 | * with the same z-index is arbitrary. The default zIndex is 0.
62 | *
63 | * @platform android
64 | */
65 | zIndex: PropTypes.number,
66 |
67 | /**
68 | * The line cap style to apply to the open ends of the path.
69 | * The default style is `round`.
70 | *
71 | * @platform ios
72 | */
73 | lineCap: PropTypes.oneOf(["butt", "round", "square"]),
74 |
75 | /**
76 | * The line join style to apply to corners of the path.
77 | * The default style is `round`.
78 | *
79 | * @platform ios
80 | */
81 | lineJoin: PropTypes.oneOf(["miter", "round", "bevel"]),
82 |
83 | /**
84 | * The limiting value that helps avoid spikes at junctions between connected line segments.
85 | * The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style. If
86 | * the ratio of the miter length—that is, the diagonal length of the miter join—to the line
87 | * thickness exceeds the miter limit, the joint is converted to a bevel join. The default
88 | * miter limit is 10, which results in the conversion of miters whose angle at the joint
89 | * is less than 11 degrees.
90 | *
91 | * @platform ios
92 | */
93 | miterLimit: PropTypes.number,
94 |
95 | /**
96 | * Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to
97 | * straight lines on the Mercator projection. A geodesic is the shortest path between two
98 | * points on the Earth's surface. The geodesic curve is constructed assuming the Earth is
99 | * a sphere.
100 | *
101 | * @platform android
102 | */
103 | geodesic: PropTypes.bool,
104 |
105 | /**
106 | * The offset (in points) at which to start drawing the dash pattern.
107 | *
108 | * Use this property to start drawing a dashed line partway through a segment or gap. For
109 | * example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the
110 | * middle of the first gap.
111 | *
112 | * The default value of this property is 0.
113 | *
114 | * @platform ios
115 | */
116 | lineDashPhase: PropTypes.number,
117 |
118 | /**
119 | * An array of numbers specifying the dash pattern to use for the path.
120 | *
121 | * The array contains one or more numbers that indicate the lengths (measured in points) of the
122 | * line segments and gaps in the pattern. The values in the array alternate, starting with the
123 | * first line segment length, followed by the first gap length, followed by the second line
124 | * segment length, and so on.
125 | *
126 | * This property is set to `null` by default, which indicates no line dash pattern.
127 | *
128 | * @platform ios
129 | */
130 | lineDashPattern: PropTypes.arrayOf(PropTypes.number),
131 | };
132 |
133 | const defaultProps = {
134 | strokeColor: "#000",
135 | strokeWidth: 1,
136 | lineJoin: "round",
137 | lineCap: "round",
138 | };
139 |
140 | class MapPolyline extends React.Component {
141 | setNativeProps(props) {
142 | this.polyline.setNativeProps(props);
143 | }
144 |
145 | render() {
146 | const AIRMapPolyline = this.getAirComponent();
147 | return (
148 | {
151 | this.polyline = ref;
152 | }}
153 | />
154 | );
155 | }
156 | }
157 |
158 | MapPolyline.propTypes = propTypes;
159 | MapPolyline.defaultProps = defaultProps;
160 |
161 | export default decorateMapComponent(MapPolyline, {
162 | componentType: "Polyline",
163 | providers: {
164 | google: {
165 | ios: SUPPORTED,
166 | android: USES_DEFAULT_IMPLEMENTATION,
167 | },
168 | },
169 | });
170 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Open Street Maps to react-native
2 |
3 | This project is one fork of [react-native-maps](https://github.com/react-community/react-native-maps) to use open-street-map
4 |
5 | [](https://www.npmjs.com/package/react-native-open-street-map)
6 |
7 | ## RoadMap
8 |
9 | - [x] change use of GoogleMaps to OpenStreetMap
10 |
11 | - [x] render map in open-street-maps in android
12 |
13 | - [ ] add props OpenStreetMap (WIP)
14 |
15 | - [x] zoom
16 | - [x] router
17 | - [x] router with one location
18 | - [ ] initial router
19 |
20 | - [ ] render open-street-maps to iOS
21 |
22 |
23 |
24 |
25 | ## How to use
26 |
27 | this project is done to render maps in open-street-maps on android
28 |
29 | ## install
30 |
31 |
32 | ```
33 | npm i react-native-open-street-map
34 | ```
35 | or
36 | ```
37 | yarn add react-native-open-street-map
38 | ```
39 |
40 | ### Android
41 |
42 | `setting.gradle`
43 |
44 | ```gradle
45 | // Open Street Map
46 | include ':react-native-open-street-map'
47 | project(':react-native-open-street-map').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-open-street-map/lib/android')
48 | ```
49 |
50 | `app/build.gradle`
51 |
52 | ```gradle
53 |
54 | dependencies {
55 | ...
56 | compile (project(':react-native-open-street-map')) {
57 | // if you use the lib gms in the project or libs on project
58 | exclude group: 'com.google.android.gms'
59 | }
60 | ```
61 |
62 | `app/src/main/java/{project_name}/MainApplication.java`
63 | ```java
64 |
65 | ...
66 | import com.airbnb.android.react.maps.MapsPackage;
67 |
68 | public class MainApplication extends Application implements ReactApplication {
69 |
70 | @Override
71 | protected List getPackages() {
72 | new MainReactPackage(),
73 | new MapsPackage() // insert this line to init module maps
74 | }
75 | }
76 | ```
77 |
78 |
79 | ### iOS
80 |
81 | the iOS instalation is equals in the lib of react-native-maps because this fork not set iOS to use Open Street Maps, only Apple Maps.
82 |
83 | ## Props
84 |
85 | name | type | iOS | Android | Info
86 | ------ | ---- | ------- | ---- | ----
87 | router | Object | - | OK | router object espcificate in [routerObject](#router-object)
88 | region | Geolocation | - | OK | the initial region render map
89 | zoom | int | - | OK | show init zoom
90 | showsUserLocation | boolean | - | OK | show location in Map
91 |
92 | ### Router Object
93 | name | type | required | Info
94 | ----- | ----- | ----- | -----
95 | coordinates | Array | true | array of object with latitude and longitude
96 | titleA | String | true | title of first location
97 | descriptionA | String | true | description of first location
98 | titleB | String | false | title of second location
99 | descriptionB | String | false | description of second location
100 |
101 |
102 | ## Exaple
103 |
104 | ### How to make router from point A to point B
105 |
106 | ```jsx
107 | import React from 'react';
108 | import { Dimensions } from 'react-native';
109 | import MapView from 'react-native-open-street-map';
110 |
111 | class CustonMap extends React.PureComponent {
112 | render() {
113 | const {
114 | width,
115 | height,
116 | } = Dimensions.get('window');
117 | const region = {
118 | latitude: 0,
119 | longitude: 0,
120 | latitudeDelta: 0.0922,
121 | longitudeDelta: 0.0922 * (width / height)
122 | };
123 | const latitudes = [-15.806553, -15.8202434];
124 | const longitudes = [-47.8891454, -47.9045093];
125 |
126 | return (
127 |
152 | );
153 | }
154 | }
155 |
156 | ```
157 |
158 |
159 | #### sample router with one point object
160 |
161 | ```jsx
162 | import React from 'react';
163 | import { Dimensions } from 'react-native';
164 | import MapView from 'react-native-open-street-map';
165 |
166 | class CustonMap extends React.PureComponent {
167 | render() {
168 | const {
169 | width,
170 | height,
171 | } = Dimensions.get('window');
172 | const region = {
173 | latitude: 0,
174 | longitude: 0,
175 | latitudeDelta: 0.0922,
176 | longitudeDelta: 0.0922 * (width / height)
177 | };
178 | return (
179 |
197 | );
198 | }
199 | }
200 | ```
201 |
--------------------------------------------------------------------------------
/lib/components/MapPolygon.js:
--------------------------------------------------------------------------------
1 | import PropTypes from 'prop-types';
2 | import React from 'react';
3 | import {
4 | ViewPropTypes,
5 | View,
6 | } from 'react-native';
7 | import decorateMapComponent, {
8 | USES_DEFAULT_IMPLEMENTATION,
9 | SUPPORTED,
10 | } from './decorateMapComponent';
11 |
12 | // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
13 | const viewPropTypes = ViewPropTypes || View.propTypes;
14 |
15 | const propTypes = {
16 | ...viewPropTypes,
17 |
18 | /**
19 | * An array of coordinates to describe the polygon
20 | */
21 | coordinates: PropTypes.arrayOf(PropTypes.shape({
22 | /**
23 | * Latitude/Longitude coordinates
24 | */
25 | latitude: PropTypes.number.isRequired,
26 | longitude: PropTypes.number.isRequired,
27 | })),
28 |
29 | /**
30 | * An array of array of coordinates to describe the polygon holes
31 | */
32 | holes: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.shape({
33 | /**
34 | * Latitude/Longitude coordinates
35 | */
36 | latitude: PropTypes.number.isRequired,
37 | longitude: PropTypes.number.isRequired,
38 | }))),
39 |
40 | /**
41 | * Callback that is called when the user presses on the polygon
42 | */
43 | onPress: PropTypes.func,
44 |
45 | /**
46 | * Boolean to allow a polygon to be tappable and use the
47 | * onPress function
48 | */
49 | tappable: PropTypes.bool,
50 |
51 | /**
52 | * The stroke width to use for the path.
53 | */
54 | strokeWidth: PropTypes.number,
55 |
56 | /**
57 | * The stroke color to use for the path.
58 | */
59 | strokeColor: PropTypes.string,
60 |
61 | /**
62 | * The fill color to use for the path.
63 | */
64 | fillColor: PropTypes.string,
65 |
66 | /**
67 | * The order in which this tile overlay is drawn with respect to other overlays. An overlay
68 | * with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
69 | * with the same z-index is arbitrary. The default zIndex is 0.
70 | *
71 | * @platform android
72 | */
73 | zIndex: PropTypes.number,
74 |
75 | /**
76 | * The line cap style to apply to the open ends of the path.
77 | * The default style is `round`.
78 | *
79 | * @platform ios
80 | */
81 | lineCap: PropTypes.oneOf([
82 | 'butt',
83 | 'round',
84 | 'square',
85 | ]),
86 |
87 | /**
88 | * The line join style to apply to corners of the path.
89 | * The default style is `round`.
90 | *
91 | * @platform ios
92 | */
93 | lineJoin: PropTypes.oneOf([
94 | 'miter',
95 | 'round',
96 | 'bevel',
97 | ]),
98 |
99 | /**
100 | * The limiting value that helps avoid spikes at junctions between connected line segments.
101 | * The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style. If
102 | * the ratio of the miter length—that is, the diagonal length of the miter join—to the line
103 | * thickness exceeds the miter limit, the joint is converted to a bevel join. The default
104 | * miter limit is 10, which results in the conversion of miters whose angle at the joint
105 | * is less than 11 degrees.
106 | *
107 | * @platform ios
108 | */
109 | miterLimit: PropTypes.number,
110 |
111 | /**
112 | * Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to
113 | * straight lines on the Mercator projection. A geodesic is the shortest path between two
114 | * points on the Earth's surface. The geodesic curve is constructed assuming the Earth is
115 | * a sphere.
116 | *
117 | */
118 | geodesic: PropTypes.bool,
119 |
120 | /**
121 | * The offset (in points) at which to start drawing the dash pattern.
122 | *
123 | * Use this property to start drawing a dashed line partway through a segment or gap. For
124 | * example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the
125 | * middle of the first gap.
126 | *
127 | * The default value of this property is 0.
128 | *
129 | * @platform ios
130 | */
131 | lineDashPhase: PropTypes.number,
132 |
133 | /**
134 | * An array of numbers specifying the dash pattern to use for the path.
135 | *
136 | * The array contains one or more numbers that indicate the lengths (measured in points) of the
137 | * line segments and gaps in the pattern. The values in the array alternate, starting with the
138 | * first line segment length, followed by the first gap length, followed by the second line
139 | * segment length, and so on.
140 | *
141 | * This property is set to `null` by default, which indicates no line dash pattern.
142 | *
143 | * @platform ios
144 | */
145 | lineDashPattern: PropTypes.arrayOf(PropTypes.number),
146 | };
147 |
148 | const defaultProps = {
149 | strokeColor: '#000',
150 | strokeWidth: 1,
151 | };
152 |
153 | class MapPolygon extends React.Component {
154 | setNativeProps(props) {
155 | this.polygon.setNativeProps(props);
156 | }
157 |
158 | render() {
159 | const AIRMapPolygon = this.getAirComponent();
160 | return (
161 | { this.polygon = ref; }} />
162 | );
163 | }
164 | }
165 |
166 | MapPolygon.propTypes = propTypes;
167 | MapPolygon.defaultProps = defaultProps;
168 |
169 | export default decorateMapComponent(MapPolygon, {
170 | componentType: 'Polygon',
171 | providers: {
172 | google: {
173 | ios: SUPPORTED,
174 | android: USES_DEFAULT_IMPLEMENTATION,
175 | },
176 | },
177 | });
178 |
--------------------------------------------------------------------------------
/lib/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------