@jadamsbit/react-native-mapbox-navigation 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/.gitattributes +1 -0
  2. package/CONTRIBUTING.md +11 -0
  3. package/LICENSE +21 -0
  4. package/README.md +357 -0
  5. package/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
  6. package/android/.gradle/7.3.3/checksums/md5-checksums.bin +0 -0
  7. package/android/.gradle/7.3.3/checksums/sha1-checksums.bin +0 -0
  8. package/android/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock +0 -0
  9. package/android/.gradle/7.3.3/dependencies-accessors/gc.properties +0 -0
  10. package/android/.gradle/7.3.3/executionHistory/executionHistory.lock +0 -0
  11. package/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
  12. package/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/7.3.3/gc.properties +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  16. package/android/.gradle/vcs-1/gc.properties +0 -0
  17. package/android/README.md +14 -0
  18. package/android/build.gradle +99 -0
  19. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  20. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  21. package/android/gradle.properties +4 -0
  22. package/android/gradlew +244 -0
  23. package/android/gradlew.bat +92 -0
  24. package/android/src/main/AndroidManifest.xml +4 -0
  25. package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationManager.kt +122 -0
  26. package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationPackage.kt +16 -0
  27. package/android/src/main/java/com/jadamsbit/mapboxnavigation/MapboxNavigationView.kt +794 -0
  28. package/android/src/main/res/layout/navigation_view.xml +84 -0
  29. package/android/src/main/res/values/styles.xml +15 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +12 -0
  32. package/dist/typings.d.ts +40 -0
  33. package/dist/typings.js +1 -0
  34. package/example/.buckconfig +6 -0
  35. package/example/.eslintrc.js +4 -0
  36. package/example/.flowconfig +65 -0
  37. package/example/.prettierrc.js +7 -0
  38. package/example/.watchmanconfig +1 -0
  39. package/example/App.js +51 -0
  40. package/example/Gemfile +6 -0
  41. package/example/Gemfile.lock +100 -0
  42. package/example/NavigationComponent.js +56 -0
  43. package/example/__tests__/App-test.js +14 -0
  44. package/example/_bundle/config +2 -0
  45. package/example/_ruby-version +1 -0
  46. package/example/android/.gradle/8.2/checksums/checksums.lock +0 -0
  47. package/example/android/.gradle/8.2/fileChanges/last-build.bin +0 -0
  48. package/example/android/.gradle/8.2/fileHashes/fileHashes.lock +0 -0
  49. package/example/android/.gradle/8.2/gc.properties +0 -0
  50. package/example/android/.gradle/vcs-1/gc.properties +0 -0
  51. package/example/android/app/_BUCK +55 -0
  52. package/example/android/app/build.gradle +232 -0
  53. package/example/android/app/build_defs.bzl +19 -0
  54. package/example/android/app/debug.keystore +0 -0
  55. package/example/android/app/proguard-rules.pro +10 -0
  56. package/example/android/app/src/debug/AndroidManifest.xml +13 -0
  57. package/example/android/app/src/debug/java/com/basicapp/ReactNativeFlipper.java +72 -0
  58. package/example/android/app/src/main/AndroidManifest.xml +30 -0
  59. package/example/android/app/src/main/java/com/basicapp/MainActivity.java +15 -0
  60. package/example/android/app/src/main/java/com/basicapp/MainApplication.java +81 -0
  61. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
  62. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  63. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  64. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  65. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  66. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  67. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  68. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  69. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  70. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  71. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  72. package/example/android/app/src/main/res/values/strings.xml +3 -0
  73. package/example/android/app/src/main/res/values/styles.xml +9 -0
  74. package/example/android/build.gradle +55 -0
  75. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  76. package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  77. package/example/android/gradle.properties +35 -0
  78. package/example/android/gradlew +185 -0
  79. package/example/android/gradlew.bat +89 -0
  80. package/example/android/settings.gradle +6 -0
  81. package/example/app.json +4 -0
  82. package/example/babel.config.js +24 -0
  83. package/example/index.js +9 -0
  84. package/example/ios/BasicApp/AppDelegate.h +8 -0
  85. package/example/ios/BasicApp/AppDelegate.m +62 -0
  86. package/example/ios/BasicApp/Images.xcassets/AppIcon.appiconset/Contents.json +38 -0
  87. package/example/ios/BasicApp/Images.xcassets/Contents.json +6 -0
  88. package/example/ios/BasicApp/Info.plist +62 -0
  89. package/example/ios/BasicApp/LaunchScreen.storyboard +47 -0
  90. package/example/ios/BasicApp/main.m +9 -0
  91. package/example/ios/BasicApp-Bridging-Header.h +4 -0
  92. package/example/ios/BasicApp.xcodeproj/project.pbxproj +690 -0
  93. package/example/ios/BasicApp.xcodeproj/xcshareddata/xcschemes/BasicApp.xcscheme +88 -0
  94. package/example/ios/BasicApp.xcworkspace/contents.xcworkspacedata +10 -0
  95. package/example/ios/BasicApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  96. package/example/ios/BasicAppTests/BasicAppTests.m +65 -0
  97. package/example/ios/BasicAppTests/Info.plist +24 -0
  98. package/example/ios/BridgeHeader.swift +8 -0
  99. package/example/ios/Podfile +44 -0
  100. package/example/ios/Podfile.lock +473 -0
  101. package/example/metro.config.js +45 -0
  102. package/example/package.json +31 -0
  103. package/img/bridging-header.png +0 -0
  104. package/img/build-setting-linking.png +0 -0
  105. package/img/build-setting-path.png +0 -0
  106. package/ios/MapboxNavigation-Bridging-Header.h +3 -0
  107. package/ios/MapboxNavigation.xcodeproj/project.pbxproj +290 -0
  108. package/ios/MapboxNavigation.xcworkspace/contents.xcworkspacedata +7 -0
  109. package/ios/MapboxNavigation.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  110. package/ios/MapboxNavigationManager.m +20 -0
  111. package/ios/MapboxNavigationManager.swift +10 -0
  112. package/ios/MapboxNavigationView.swift +163 -0
  113. package/package.json +33 -0
  114. package/react-native-mapbox-navigation.podspec +51 -0
  115. package/src/index.tsx +21 -0
  116. package/src/typings.ts +43 -0
  117. package/tsconfig.json +14 -0
@@ -0,0 +1,290 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ 957B881A244753D70058C6C1 /* MapboxNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957B8816244753D70058C6C1 /* MapboxNavigationView.swift */; };
11
+ 957B881C244753D70058C6C1 /* MapboxNavigationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 957B8818244753D70058C6C1 /* MapboxNavigationManager.m */; };
12
+ 957B881D244753D70058C6C1 /* MapboxNavigationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 957B8819244753D70058C6C1 /* MapboxNavigationManager.swift */; };
13
+ /* End PBXBuildFile section */
14
+
15
+ /* Begin PBXCopyFilesBuildPhase section */
16
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
17
+ isa = PBXCopyFilesBuildPhase;
18
+ buildActionMask = 2147483647;
19
+ dstPath = "include/$(PRODUCT_NAME)";
20
+ dstSubfolderSpec = 16;
21
+ files = (
22
+ );
23
+ runOnlyForDeploymentPostprocessing = 0;
24
+ };
25
+ /* End PBXCopyFilesBuildPhase section */
26
+
27
+ /* Begin PBXFileReference section */
28
+ 134814201AA4EA6300B7C361 /* libMapboxNavigation.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMapboxNavigation.a; sourceTree = BUILT_PRODUCTS_DIR; };
29
+ 957B8815244753D60058C6C1 /* MapboxNavigation-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MapboxNavigation-Bridging-Header.h"; sourceTree = "<group>"; };
30
+ 957B8816244753D70058C6C1 /* MapboxNavigationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapboxNavigationView.swift; sourceTree = "<group>"; };
31
+ 957B8818244753D70058C6C1 /* MapboxNavigationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapboxNavigationManager.m; sourceTree = "<group>"; };
32
+ 957B8819244753D70058C6C1 /* MapboxNavigationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapboxNavigationManager.swift; sourceTree = "<group>"; };
33
+ /* End PBXFileReference section */
34
+
35
+ /* Begin PBXFrameworksBuildPhase section */
36
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
37
+ isa = PBXFrameworksBuildPhase;
38
+ buildActionMask = 2147483647;
39
+ files = (
40
+ );
41
+ runOnlyForDeploymentPostprocessing = 0;
42
+ };
43
+ /* End PBXFrameworksBuildPhase section */
44
+
45
+ /* Begin PBXGroup section */
46
+ 134814211AA4EA7D00B7C361 /* Products */ = {
47
+ isa = PBXGroup;
48
+ children = (
49
+ 134814201AA4EA6300B7C361 /* libMapboxNavigation.a */,
50
+ );
51
+ name = Products;
52
+ sourceTree = "<group>";
53
+ };
54
+ 58B511D21A9E6C8500147676 = {
55
+ isa = PBXGroup;
56
+ children = (
57
+ 957B8818244753D70058C6C1 /* MapboxNavigationManager.m */,
58
+ 957B8819244753D70058C6C1 /* MapboxNavigationManager.swift */,
59
+ 957B8816244753D70058C6C1 /* MapboxNavigationView.swift */,
60
+ 957B8815244753D60058C6C1 /* MapboxNavigation-Bridging-Header.h */,
61
+ 134814211AA4EA7D00B7C361 /* Products */,
62
+ );
63
+ sourceTree = "<group>";
64
+ };
65
+ /* End PBXGroup section */
66
+
67
+ /* Begin PBXNativeTarget section */
68
+ 58B511DA1A9E6C8500147676 /* MapboxNavigation */ = {
69
+ isa = PBXNativeTarget;
70
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "MapboxNavigation" */;
71
+ buildPhases = (
72
+ 58B511D71A9E6C8500147676 /* Sources */,
73
+ 58B511D81A9E6C8500147676 /* Frameworks */,
74
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
75
+ );
76
+ buildRules = (
77
+ );
78
+ dependencies = (
79
+ );
80
+ name = MapboxNavigation;
81
+ productName = RCTDataManager;
82
+ productReference = 134814201AA4EA6300B7C361 /* libMapboxNavigation.a */;
83
+ productType = "com.apple.product-type.library.static";
84
+ };
85
+ /* End PBXNativeTarget section */
86
+
87
+ /* Begin PBXProject section */
88
+ 58B511D31A9E6C8500147676 /* Project object */ = {
89
+ isa = PBXProject;
90
+ attributes = {
91
+ LastUpgradeCheck = 0920;
92
+ ORGANIZATIONNAME = Facebook;
93
+ TargetAttributes = {
94
+ 58B511DA1A9E6C8500147676 = {
95
+ CreatedOnToolsVersion = 6.1.1;
96
+ LastSwiftMigration = 1140;
97
+ };
98
+ };
99
+ };
100
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "MapboxNavigation" */;
101
+ compatibilityVersion = "Xcode 3.2";
102
+ developmentRegion = English;
103
+ hasScannedForEncodings = 0;
104
+ knownRegions = (
105
+ English,
106
+ en,
107
+ );
108
+ mainGroup = 58B511D21A9E6C8500147676;
109
+ productRefGroup = 58B511D21A9E6C8500147676;
110
+ projectDirPath = "";
111
+ projectRoot = "";
112
+ targets = (
113
+ 58B511DA1A9E6C8500147676 /* MapboxNavigation */,
114
+ );
115
+ };
116
+ /* End PBXProject section */
117
+
118
+ /* Begin PBXSourcesBuildPhase section */
119
+ 58B511D71A9E6C8500147676 /* Sources */ = {
120
+ isa = PBXSourcesBuildPhase;
121
+ buildActionMask = 2147483647;
122
+ files = (
123
+ 957B881C244753D70058C6C1 /* MapboxNavigationManager.m in Sources */,
124
+ 957B881D244753D70058C6C1 /* MapboxNavigationManager.swift in Sources */,
125
+ 957B881A244753D70058C6C1 /* MapboxNavigationView.swift in Sources */,
126
+ );
127
+ runOnlyForDeploymentPostprocessing = 0;
128
+ };
129
+ /* End PBXSourcesBuildPhase section */
130
+
131
+ /* Begin XCBuildConfiguration section */
132
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
133
+ isa = XCBuildConfiguration;
134
+ buildSettings = {
135
+ ALWAYS_SEARCH_USER_PATHS = NO;
136
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
137
+ CLANG_CXX_LIBRARY = "libc++";
138
+ CLANG_ENABLE_MODULES = YES;
139
+ CLANG_ENABLE_OBJC_ARC = YES;
140
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
141
+ CLANG_WARN_BOOL_CONVERSION = YES;
142
+ CLANG_WARN_COMMA = YES;
143
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
144
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
145
+ CLANG_WARN_EMPTY_BODY = YES;
146
+ CLANG_WARN_ENUM_CONVERSION = YES;
147
+ CLANG_WARN_INFINITE_RECURSION = YES;
148
+ CLANG_WARN_INT_CONVERSION = YES;
149
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
150
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
151
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
152
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
153
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
154
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
155
+ CLANG_WARN_UNREACHABLE_CODE = YES;
156
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
157
+ COPY_PHASE_STRIP = NO;
158
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
159
+ ENABLE_TESTABILITY = YES;
160
+ GCC_C_LANGUAGE_STANDARD = gnu99;
161
+ GCC_DYNAMIC_NO_PIC = NO;
162
+ GCC_NO_COMMON_BLOCKS = YES;
163
+ GCC_OPTIMIZATION_LEVEL = 0;
164
+ GCC_PREPROCESSOR_DEFINITIONS = (
165
+ "DEBUG=1",
166
+ "$(inherited)",
167
+ );
168
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
169
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
170
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
171
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
172
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
173
+ GCC_WARN_UNUSED_FUNCTION = YES;
174
+ GCC_WARN_UNUSED_VARIABLE = YES;
175
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
176
+ MTL_ENABLE_DEBUG_INFO = YES;
177
+ ONLY_ACTIVE_ARCH = YES;
178
+ SDKROOT = iphoneos;
179
+ };
180
+ name = Debug;
181
+ };
182
+ 58B511EE1A9E6C8500147676 /* Release */ = {
183
+ isa = XCBuildConfiguration;
184
+ buildSettings = {
185
+ ALWAYS_SEARCH_USER_PATHS = NO;
186
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
187
+ CLANG_CXX_LIBRARY = "libc++";
188
+ CLANG_ENABLE_MODULES = YES;
189
+ CLANG_ENABLE_OBJC_ARC = YES;
190
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
191
+ CLANG_WARN_BOOL_CONVERSION = YES;
192
+ CLANG_WARN_COMMA = YES;
193
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
194
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
195
+ CLANG_WARN_EMPTY_BODY = YES;
196
+ CLANG_WARN_ENUM_CONVERSION = YES;
197
+ CLANG_WARN_INFINITE_RECURSION = YES;
198
+ CLANG_WARN_INT_CONVERSION = YES;
199
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
200
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
201
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
202
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
203
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
204
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
205
+ CLANG_WARN_UNREACHABLE_CODE = YES;
206
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
207
+ COPY_PHASE_STRIP = YES;
208
+ ENABLE_NS_ASSERTIONS = NO;
209
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
210
+ GCC_C_LANGUAGE_STANDARD = gnu99;
211
+ GCC_NO_COMMON_BLOCKS = YES;
212
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
213
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
214
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
215
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
216
+ GCC_WARN_UNUSED_FUNCTION = YES;
217
+ GCC_WARN_UNUSED_VARIABLE = YES;
218
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
219
+ MTL_ENABLE_DEBUG_INFO = NO;
220
+ SDKROOT = iphoneos;
221
+ VALIDATE_PRODUCT = YES;
222
+ };
223
+ name = Release;
224
+ };
225
+ 58B511F01A9E6C8500147676 /* Debug */ = {
226
+ isa = XCBuildConfiguration;
227
+ buildSettings = {
228
+ CLANG_ENABLE_MODULES = YES;
229
+ HEADER_SEARCH_PATHS = (
230
+ "$(inherited)",
231
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
232
+ "$(SRCROOT)/../../../React/**",
233
+ "$(SRCROOT)/../../react-native/React/**",
234
+ );
235
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
236
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
237
+ OTHER_LDFLAGS = "-ObjC";
238
+ PRODUCT_NAME = MapboxNavigation;
239
+ SKIP_INSTALL = YES;
240
+ SWIFT_OBJC_BRIDGING_HEADER = "MapboxNavigation-Bridging-Header.h";
241
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
242
+ SWIFT_VERSION = 5.0;
243
+ };
244
+ name = Debug;
245
+ };
246
+ 58B511F11A9E6C8500147676 /* Release */ = {
247
+ isa = XCBuildConfiguration;
248
+ buildSettings = {
249
+ CLANG_ENABLE_MODULES = YES;
250
+ HEADER_SEARCH_PATHS = (
251
+ "$(inherited)",
252
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
253
+ "$(SRCROOT)/../../../React/**",
254
+ "$(SRCROOT)/../../react-native/React/**",
255
+ );
256
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
257
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
258
+ OTHER_LDFLAGS = "-ObjC";
259
+ PRODUCT_NAME = MapboxNavigation;
260
+ SKIP_INSTALL = YES;
261
+ SWIFT_OBJC_BRIDGING_HEADER = "MapboxNavigation-Bridging-Header.h";
262
+ SWIFT_VERSION = 5.0;
263
+ };
264
+ name = Release;
265
+ };
266
+ /* End XCBuildConfiguration section */
267
+
268
+ /* Begin XCConfigurationList section */
269
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "MapboxNavigation" */ = {
270
+ isa = XCConfigurationList;
271
+ buildConfigurations = (
272
+ 58B511ED1A9E6C8500147676 /* Debug */,
273
+ 58B511EE1A9E6C8500147676 /* Release */,
274
+ );
275
+ defaultConfigurationIsVisible = 0;
276
+ defaultConfigurationName = Release;
277
+ };
278
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "MapboxNavigation" */ = {
279
+ isa = XCConfigurationList;
280
+ buildConfigurations = (
281
+ 58B511F01A9E6C8500147676 /* Debug */,
282
+ 58B511F11A9E6C8500147676 /* Release */,
283
+ );
284
+ defaultConfigurationIsVisible = 0;
285
+ defaultConfigurationName = Release;
286
+ };
287
+ /* End XCConfigurationList section */
288
+ };
289
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
290
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "group:MapboxNavigation.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,20 @@
1
+ #import "React/RCTViewManager.h"
2
+
3
+ @interface RCT_EXTERN_MODULE(MapboxNavigationManager, RCTViewManager)
4
+
5
+ RCT_EXPORT_VIEW_PROPERTY(onLocationChange, RCTDirectEventBlock)
6
+ RCT_EXPORT_VIEW_PROPERTY(onRouteProgressChange, RCTDirectEventBlock)
7
+ RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock)
8
+ RCT_EXPORT_VIEW_PROPERTY(onCancelNavigation, RCTDirectEventBlock)
9
+ RCT_EXPORT_VIEW_PROPERTY(onArrive, RCTDirectEventBlock)
10
+ RCT_EXPORT_VIEW_PROPERTY(origin, NSArray)
11
+ RCT_EXPORT_VIEW_PROPERTY(destination, NSArray)
12
+ RCT_EXPORT_VIEW_PROPERTY(shouldSimulateRoute, BOOL)
13
+ RCT_EXPORT_VIEW_PROPERTY(showsEndOfRouteFeedback, BOOL)
14
+ RCT_EXPORT_VIEW_PROPERTY(hideStatusView, BOOL)
15
+ RCT_EXPORT_VIEW_PROPERTY(mute, BOOL)
16
+ RCT_EXPORT_VIEW_PROPERTY(waypoints, NSArray<NSArray>)
17
+ RCT_EXPORT_VIEW_PROPERTY(vehicleMaxHeight, NSNumber)
18
+ RCT_EXPORT_VIEW_PROPERTY(vehicleMaxWidth, NSNumber)
19
+
20
+ @end
@@ -0,0 +1,10 @@
1
+ @objc(MapboxNavigationManager)
2
+ class MapboxNavigationManager: RCTViewManager {
3
+ override func view() -> UIView! {
4
+ return MapboxNavigationView();
5
+ }
6
+
7
+ override static func requiresMainQueueSetup() -> Bool {
8
+ return true
9
+ }
10
+ }
@@ -0,0 +1,163 @@
1
+ import MapboxCoreNavigation
2
+ import MapboxNavigation
3
+ import MapboxDirections
4
+
5
+ // // adapted from https://pspdfkit.com/blog/2017/native-view-controllers-and-react-native/ and https://github.com/mslabenyak/react-native-mapbox-navigation/blob/master/ios/Mapbox/MapboxNavigationView.swift
6
+ extension UIView {
7
+ var parentViewController: UIViewController? {
8
+ var parentResponder: UIResponder? = self
9
+ while parentResponder != nil {
10
+ parentResponder = parentResponder!.next
11
+ if let viewController = parentResponder as? UIViewController {
12
+ return viewController
13
+ }
14
+ }
15
+ return nil
16
+ }
17
+ }
18
+
19
+ class MapboxNavigationView: UIView, NavigationViewControllerDelegate {
20
+ weak var navViewController: NavigationViewController?
21
+ var embedded: Bool
22
+ var embedding: Bool
23
+
24
+ @objc var origin: NSArray = [] {
25
+ didSet { setNeedsLayout() }
26
+ }
27
+
28
+ @objc var waypoints: NSArray = [] {
29
+ didSet { setNeedsLayout() }
30
+ }
31
+
32
+ @objc var destination: NSArray = [] {
33
+ didSet { setNeedsLayout() }
34
+ }
35
+
36
+ @objc var shouldSimulateRoute: Bool = false
37
+ @objc var showsEndOfRouteFeedback: Bool = false
38
+ @objc var hideStatusView: Bool = false
39
+ @objc var mute: Bool = false
40
+
41
+ @objc var onLocationChange: RCTDirectEventBlock?
42
+ @objc var onRouteProgressChange: RCTDirectEventBlock?
43
+ @objc var onError: RCTDirectEventBlock?
44
+ @objc var onCancelNavigation: RCTDirectEventBlock?
45
+ @objc var onArrive: RCTDirectEventBlock?
46
+ @objc var vehicleMaxHeight: NSNumber?
47
+ @objc var vehicleMaxWidth: NSNumber?
48
+
49
+ override init(frame: CGRect) {
50
+ self.embedded = false
51
+ self.embedding = false
52
+ super.init(frame: frame)
53
+ }
54
+
55
+ required init?(coder aDecoder: NSCoder) {
56
+ fatalError("init(coder:) has not been implemented")
57
+ }
58
+
59
+ override func layoutSubviews() {
60
+ super.layoutSubviews()
61
+
62
+ if (navViewController == nil && !embedding && !embedded) {
63
+ embed()
64
+ } else {
65
+ navViewController?.view.frame = bounds
66
+ }
67
+ }
68
+
69
+ override func removeFromSuperview() {
70
+ super.removeFromSuperview()
71
+ // cleanup and teardown any existing resources
72
+ self.navViewController?.removeFromParent()
73
+ }
74
+
75
+ private func embed() {
76
+ guard origin.count == 2 && destination.count == 2 else { return }
77
+
78
+ embedding = true
79
+
80
+ let originWaypoint = Waypoint(coordinate: CLLocationCoordinate2D(latitude: origin[1] as! CLLocationDegrees, longitude: origin[0] as! CLLocationDegrees))
81
+ let destinationWaypoint = Waypoint(coordinate: CLLocationCoordinate2D(latitude: destination[1] as! CLLocationDegrees, longitude: destination[0] as! CLLocationDegrees))
82
+
83
+ var waypointsArray = [originWaypoint]
84
+
85
+ // Adding intermediate waypoints if any
86
+ for waypointArray in waypoints {
87
+ if let waypointCoordinates = waypointArray as? NSArray, waypointCoordinates.count == 2,
88
+ let lat = waypointCoordinates[1] as? CLLocationDegrees, let lon = waypointCoordinates[0] as? CLLocationDegrees {
89
+ let waypoint = Waypoint(coordinate: CLLocationCoordinate2D(latitude: lat, longitude: lon))
90
+ waypointsArray.append(waypoint)
91
+ }
92
+ }
93
+
94
+ waypointsArray.append(destinationWaypoint)
95
+
96
+ // let options = NavigationRouteOptions(waypoints: [originWaypoint, destinationWaypoint])
97
+ let options = NavigationRouteOptions(waypoints: [originWaypoint, destinationWaypoint], profileIdentifier: .automobileAvoidingTraffic)
98
+
99
+ if let vehicleMaxHeight = vehicleMaxHeight?.doubleValue {
100
+ options.includesMaxHeightOnMostRestrictiveBridge = true
101
+ options.maxHeight = vehicleMaxHeight
102
+ }
103
+ if let vehicleMaxWidth = vehicleMaxWidth?.doubleValue {
104
+ options.maxWidth = vehicleMaxWidth
105
+ }
106
+
107
+ Directions.shared.calculate(options) { [weak self] (_, result) in
108
+ guard let strongSelf = self, let parentVC = strongSelf.parentViewController else {
109
+ return
110
+ }
111
+
112
+ switch result {
113
+ case .failure(let error):
114
+ strongSelf.onError!(["message": error.localizedDescription])
115
+ case .success(let response):
116
+ guard let weakSelf = self else {
117
+ return
118
+ }
119
+
120
+ let navigationService = MapboxNavigationService(routeResponse: response, routeIndex: 0, routeOptions: options, simulating: strongSelf.shouldSimulateRoute ? .always : .never)
121
+
122
+ let navigationOptions = NavigationOptions(navigationService: navigationService)
123
+ let vc = NavigationViewController(for: response, routeIndex: 0, routeOptions: options, navigationOptions: navigationOptions)
124
+
125
+ vc.showsEndOfRouteFeedback = strongSelf.showsEndOfRouteFeedback
126
+ StatusView.appearance().isHidden = strongSelf.hideStatusView
127
+
128
+ NavigationSettings.shared.voiceMuted = strongSelf.mute;
129
+
130
+ vc.delegate = strongSelf
131
+
132
+ parentVC.addChild(vc)
133
+ strongSelf.addSubview(vc.view)
134
+ vc.view.frame = strongSelf.bounds
135
+ vc.didMove(toParent: parentVC)
136
+ strongSelf.navViewController = vc
137
+ }
138
+
139
+ strongSelf.embedding = false
140
+ strongSelf.embedded = true
141
+ }
142
+ }
143
+
144
+ func navigationViewController(_ navigationViewController: NavigationViewController, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation) {
145
+ onLocationChange?(["longitude": location.coordinate.longitude, "latitude": location.coordinate.latitude])
146
+ onRouteProgressChange?(["distanceTraveled": progress.distanceTraveled,
147
+ "durationRemaining": progress.durationRemaining,
148
+ "fractionTraveled": progress.fractionTraveled,
149
+ "distanceRemaining": progress.distanceRemaining])
150
+ }
151
+
152
+ func navigationViewControllerDidDismiss(_ navigationViewController: NavigationViewController, byCanceling canceled: Bool) {
153
+ if (!canceled) {
154
+ return;
155
+ }
156
+ onCancelNavigation?(["message": ""]);
157
+ }
158
+
159
+ func navigationViewController(_ navigationViewController: NavigationViewController, didArriveAt waypoint: Waypoint) -> Bool {
160
+ onArrive?(["message": ""]);
161
+ return true;
162
+ }
163
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@jadamsbit/react-native-mapbox-navigation",
3
+ "version": "1.0.0",
4
+ "description": "Smart Mapbox turn-by-turn routing based on real-time traffic for React Native.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "author": "Jamie Adams<adams.jamie@bitsourceky.com>",
8
+ "repository": "git@github.com:jadamsbit/react-native-mapbox-navigation.git",
9
+ "keywords": [
10
+ "react-native",
11
+ "mapbox",
12
+ "navigation"
13
+ ],
14
+ "license": "MIT",
15
+ "readmeFilename": "README.md",
16
+ "bugs": {
17
+ "url": "https://github.com/jadamsbit/react-native-mapbox-navigation/issues"
18
+ },
19
+ "homepage": "https://github.com/jadamsbit/react-native-mapbox-navigation#readme",
20
+ "peerDependencies": {
21
+ "react": "*",
22
+ "react-native": "*"
23
+ },
24
+ "devDependencies": {
25
+ "react": "18.2.0",
26
+ "react-native": "0.73.5",
27
+ "typescript": "5.0.4"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "name": "https://registry.yarnpkg.com/@jadamsbit/react-native-mapbox-navigation"
32
+ }
33
+ }
@@ -0,0 +1,51 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ # TargetsToChangeToDynamic = ['MapboxMobileEvents']
6
+ TargetsToChangeToDynamic = []
7
+
8
+ $RNMBNAV = Object.new
9
+
10
+ def $RNMBNAV.post_install(installer)
11
+ installer.pod_targets.each do |pod|
12
+ if TargetsToChangeToDynamic.include?(pod.name)
13
+ if pod.send(:build_type) != Pod::BuildType.dynamic_framework
14
+ pod.instance_variable_set(:@build_type,Pod::BuildType.dynamic_framework)
15
+ puts "* Changed #{pod.name} to `#{pod.send(:build_type)}`"
16
+ fail "Unable to change build_type" unless mobile_events_target.send(:build_type) == Pod::BuildType.dynamic_framework
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ def $RNMBNAV.pre_install(installer)
23
+ installer.aggregate_targets.each do |target|
24
+ target.pod_targets.select { |p| TargetsToChangeToDynamic.include?(p.name) }.each do |mobile_events_target|
25
+ mobile_events_target.instance_variable_set(:@build_type,Pod::BuildType.dynamic_framework)
26
+ puts "* Changed #{mobile_events_target.name} to #{mobile_events_target.send(:build_type)}"
27
+ fail "Unable to change build_type" unless mobile_events_target.send(:build_type) == Pod::BuildType.dynamic_framework
28
+ end
29
+ end
30
+ end
31
+
32
+ Pod::Spec.new do |s|
33
+ s.name = "react-native-mapbox-navigation"
34
+ s.version = package["version"]
35
+ s.summary = package["description"]
36
+ s.description = <<-DESC
37
+ Smart Mapbox turn-by-turn routing based on real-time traffic for React Native.
38
+ DESC
39
+ s.homepage = "https://github.com/jadamsbit/react-native-mapbox-navigation"
40
+ s.license = { :type => "MIT", :file => "LICENSE" }
41
+ s.authors = { "Jamie Adams" => "adams.jamie@bitsourceky.com" }
42
+ s.platforms = { :ios => "12.4" }
43
+ s.source = { :git => "https://github.com/jadamsbit/react-native-mapbox-navigation.git", :tag => "#{s.version}" }
44
+
45
+ s.source_files = "ios/**/*.{h,m,swift}"
46
+ s.requires_arc = true
47
+
48
+ s.dependency "React-Core"
49
+ s.dependency "MapboxNavigation", "~> 2.17.0"
50
+ end
51
+
package/src/index.tsx ADDED
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { requireNativeComponent, StyleSheet } from 'react-native';
3
+
4
+ import { IMapboxNavigationProps } from './typings';
5
+
6
+ const MapboxNavigation = (props: IMapboxNavigationProps) => {
7
+ return <RNMapboxNavigation style={styles.container} {...props} />;
8
+ };
9
+
10
+ const RNMapboxNavigation = requireNativeComponent(
11
+ 'MapboxNavigation',
12
+ MapboxNavigation
13
+ );
14
+
15
+ const styles = StyleSheet.create({
16
+ container: {
17
+ flex: 1,
18
+ },
19
+ });
20
+
21
+ export default MapboxNavigation;
package/src/typings.ts ADDED
@@ -0,0 +1,43 @@
1
+ /** @type {[number, number]}
2
+ * Provide an array with longitude and latitude [$longitude, $latitude]
3
+ */
4
+ type Coordinate = [number, number];
5
+
6
+ type OnLocationChangeEvent = {
7
+ nativeEvent?: {
8
+ latitude: number;
9
+ longitude: number;
10
+ };
11
+ };
12
+
13
+ type OnRouteProgressChangeEvent = {
14
+ nativeEvent?: {
15
+ distanceTraveled: number;
16
+ durationRemaining: number;
17
+ fractionTraveled: number;
18
+ distanceRemaining: number;
19
+ };
20
+ };
21
+
22
+ type OnErrorEvent = {
23
+ nativeEvent?: {
24
+ message?: string;
25
+ };
26
+ };
27
+
28
+ export interface IMapboxNavigationProps {
29
+ origin: Coordinate;
30
+ destination: Coordinate;
31
+ shouldSimulateRoute?: boolean;
32
+ onLocationChange?: (event: OnLocationChangeEvent) => void;
33
+ onRouteProgressChange?: (event: OnRouteProgressChangeEvent) => void;
34
+ onError?: (event: OnErrorEvent) => void;
35
+ onCancelNavigation?: () => void;
36
+ onArrive?: () => void;
37
+ showsEndOfRouteFeedback?: boolean;
38
+ hideStatusView?: boolean;
39
+ mute?: boolean;
40
+ waypoints?: Coordinate[];
41
+ vehicleMaxHeight?: number;
42
+ vehicleMaxWidth?: number;
43
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "module": "es6",
5
+ "declaration": true,
6
+ "outDir": "./dist",
7
+ "strict": false,
8
+ "jsx": "react-native",
9
+ "skipLibCheck": true,
10
+ "moduleResolution": "node"
11
+ },
12
+ "include": ["src"],
13
+ "exclude": ["node_modules", "**/__tests__/*", "example"]
14
+ }