@complexify/expo-mapbox-navigation 1.3.1 → 1.3.3
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.
- package/build/ExpoMapboxNavigation.types.js.map +1 -1
- package/ios/CustomNavigationStyle.swift +0 -190
- package/ios/ExpoMapboxNavigation.podspec +3 -0
- package/ios/ExpoMapboxNavigationModule.swift +0 -203
- package/ios/ExpoMapboxNavigationView.swift +82 -0
- package/package.json +1 -1
- package/src/ExpoMapboxNavigation.types.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExpoMapboxNavigation.types.js","sourceRoot":"","sources":["../src/ExpoMapboxNavigation.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ViewStyle, StyleProp } from \"react-native/types\";\n\ntype ProgressEvent = {\n distanceRemaining: number;\n distanceTraveled: number;\n durationRemaining: number;\n fractionTraveled: number;\n};\n\nexport type ExpoMapboxNavigationViewProps = {\n coordinates: Array<{ latitude: number; longitude: number }>;\n waypointIndices?: number[];\n useRouteMatchingApi?: boolean;\n locale?: string;\n routeProfile?: string;\n routeExcludeList?: string[];\n mapStyle?: string;\n mute?: boolean;\n routeColor?: string;\n routeAlternateColor?: string;\n routeCasingColor?: string;\n routeAlternateCasingColor?: string;\n traversedRouteColor?: string;\n maneuverArrowColor?: string;\n onRouteProgressChanged?: (event: { nativeEvent: ProgressEvent }) => void;\n onCancelNavigation?: () => void;\n onWaypointArrival?: (event: {\n nativeEvent: ProgressEvent | undefined;\n }) => void;\n onFinalDestinationArrival?: () => void;\n onRouteChanged?: () => void;\n onUserOffRoute?: () => void;\n onRoutesLoaded?: () => void;\n style?: StyleProp<ViewStyle>;\n\n // Top Banner (1)\n topBannerBackgroundColor?: string;\n topBannerPrimaryTextColor?: string;\n topBannerSecondaryTextColor?: string;\n topBannerDistanceTextColor?: string;\n topBannerSeparatorColor?: string;\n\n // Information Stack (2)\n informationStackBackgroundColor?: string;\n informationStackTextColor?: string;\n\n // Bottom Banner (3)\n bottomBannerBackgroundColor?: string;\n bottomBannerTimeRemainingTextColor?: string;\n bottomBannerDistanceRemainingTextColor?: string;\n bottomBannerArrivalTimeTextColor?: string;\n\n // Resume Button (4)\n resumeButtonBackgroundColor?: string;\n resumeButtonTextColor?: string;\n resumeButtonBorderColor?: string;\n\n // Speed Limit View (5)\n speedLimitBackgroundColor?: string;\n speedLimitTextColor?: string;\n speedLimitBorderColor?: string;\n\n // Floating Stack (6)\n floatingStackBackgroundColor?: string;\n floatingButtonsBackgroundColor?: string;\n floatingButtonsTextColor?: string;\n floatingButtonsBorderColor?: string;\n\n // Way Name Label (8)\n wayNameViewBackgroundColor?: string;\n wayNameViewTextColor?: string;\n\n // Steps List\n stepsBackgroundColor?: string;\n stepsPrimaryTextColor?: string;\n stepsSecondaryTextColor?: string;\n stepsManeuverViewPrimaryColor?: string;\n stepsManeuverViewSecondaryColor?: string;\n stepsSeparatorColor?: string;\n\n // Lane View\n laneViewBackgroundColor?: string;\n laneViewForegroundColor?: string;\n laneViewSeparatorColor?: string;\n\n // Next Banner View\n nextBannerBackgroundColor?: string;\n nextBannerPrimaryTextColor?: string;\n nextBannerSecondaryTextColor?: string;\n nextBannerDistanceTextColor?: string;\n\n // Progress Bar\n progressBarProgressColor?: string;\n progressBarBackgroundColor?: string;\n\n // Maneuver View (Direction Arrow)\n maneuverViewPrimaryColor?: string;\n maneuverViewSecondaryColor?: string;\n maneuverViewPrimaryColorHighlighted?: string;\n maneuverViewSecondaryColorHighlighted?: string;\n\n // Instructions View\n instructionsTextColor?: string;
|
1
|
+
{"version":3,"file":"ExpoMapboxNavigation.types.js","sourceRoot":"","sources":["../src/ExpoMapboxNavigation.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ViewStyle, StyleProp } from \"react-native/types\";\n\ntype ProgressEvent = {\n distanceRemaining: number;\n distanceTraveled: number;\n durationRemaining: number;\n fractionTraveled: number;\n};\n\nexport type ExpoMapboxNavigationViewProps = {\n coordinates: Array<{ latitude: number; longitude: number }>;\n waypointIndices?: number[];\n useRouteMatchingApi?: boolean;\n locale?: string;\n routeProfile?: string;\n routeExcludeList?: string[];\n mapStyle?: string;\n mute?: boolean;\n routeColor?: string;\n routeAlternateColor?: string;\n routeCasingColor?: string;\n routeAlternateCasingColor?: string;\n traversedRouteColor?: string;\n maneuverArrowColor?: string;\n onRouteProgressChanged?: (event: { nativeEvent: ProgressEvent }) => void;\n onCancelNavigation?: () => void;\n onWaypointArrival?: (event: {\n nativeEvent: ProgressEvent | undefined;\n }) => void;\n onFinalDestinationArrival?: () => void;\n onRouteChanged?: () => void;\n onUserOffRoute?: () => void;\n onRoutesLoaded?: () => void;\n style?: StyleProp<ViewStyle>;\n\n // Top Banner (1)\n topBannerBackgroundColor?: string;\n topBannerPrimaryTextColor?: string;\n topBannerSecondaryTextColor?: string;\n topBannerDistanceTextColor?: string;\n topBannerSeparatorColor?: string;\n\n // Information Stack (2)\n informationStackBackgroundColor?: string;\n informationStackTextColor?: string;\n\n // Bottom Banner (3)\n bottomBannerBackgroundColor?: string;\n bottomBannerTimeRemainingTextColor?: string;\n bottomBannerDistanceRemainingTextColor?: string;\n bottomBannerArrivalTimeTextColor?: string;\n\n // Resume Button (4)\n resumeButtonBackgroundColor?: string;\n resumeButtonTextColor?: string;\n resumeButtonBorderColor?: string;\n\n // Speed Limit View (5)\n speedLimitBackgroundColor?: string;\n speedLimitTextColor?: string;\n speedLimitBorderColor?: string;\n\n // Floating Stack (6)\n floatingStackBackgroundColor?: string;\n floatingButtonsBackgroundColor?: string;\n floatingButtonsTextColor?: string;\n floatingButtonsBorderColor?: string;\n\n // Way Name Label (8)\n wayNameViewBackgroundColor?: string;\n wayNameViewTextColor?: string;\n\n // Steps List\n stepsBackgroundColor?: string;\n stepsPrimaryTextColor?: string;\n stepsSecondaryTextColor?: string;\n stepsManeuverViewPrimaryColor?: string;\n stepsManeuverViewSecondaryColor?: string;\n stepsSeparatorColor?: string;\n\n // Lane View\n laneViewBackgroundColor?: string;\n laneViewForegroundColor?: string;\n laneViewSeparatorColor?: string;\n\n // Next Banner View\n nextBannerBackgroundColor?: string;\n nextBannerPrimaryTextColor?: string;\n nextBannerSecondaryTextColor?: string;\n nextBannerDistanceTextColor?: string;\n\n // Progress Bar\n progressBarProgressColor?: string;\n progressBarBackgroundColor?: string;\n\n // Maneuver View (Direction Arrow)\n maneuverViewPrimaryColor?: string;\n maneuverViewSecondaryColor?: string;\n maneuverViewPrimaryColorHighlighted?: string;\n maneuverViewSecondaryColorHighlighted?: string;\n\n // Instructions View\n instructionsTextColor?: string; // Color for all instruction text\n instructionsBackgroundColor?: string; // Background color for instruction panels\n\n // Instructions Card\n instructionsCardBackgroundColor?: string;\n instructionsCardSeparatorColor?: string;\n instructionsCardHighlightedSeparatorColor?: string;\n\n // Exit View\n exitViewForegroundColor?: string;\n exitViewBorderColor?: string;\n exitViewHighlightColor?: string;\n\n // Route Shield\n routeShieldForegroundColor?: string;\n routeShieldBorderColor?: string;\n routeShieldHighlightColor?: string;\n\n // Distance Labels\n distanceRemainingColor?: string;\n distanceUnitColor?: string;\n distanceValueColor?: string;\n\n // Navigation Map\n routeAnnotationSelectedColor?: string;\n routeAnnotationColor?: string;\n routeAnnotationTextColor?: string;\n routeAnnotationSelectedTextColor?: string;\n routeAnnotationMoreTimeTextColor?: string;\n routeAnnotationLessTimeTextColor?: string;\n waypointColor?: string;\n waypointStrokeColor?: string;\n\n // Feedback\n feedbackBackgroundColor?: string;\n feedbackTextColor?: string;\n feedbackCellColor?: string;\n feedbackSubtypeCircleColor?: string;\n feedbackSubtypeCircleOutlineColor?: string;\n\n // End of Route\n endOfRouteButtonTextColor?: string;\n endOfRouteCommentBackgroundColor?: string;\n endOfRouteCommentTextColor?: string;\n endOfRouteContentBackgroundColor?: string;\n endOfRouteTitleTextColor?: string;\n\n // Road Shield Colors\n roadShieldBlackColor?: string;\n roadShieldBlueColor?: string;\n roadShieldGreenColor?: string;\n roadShieldRedColor?: string;\n roadShieldWhiteColor?: string;\n roadShieldYellowColor?: string;\n roadShieldDefaultColor?: string;\n\n // Button Properties\n buttonTextColor?: string;\n cancelButtonTintColor?: string;\n previewButtonTintColor?: string;\n startButtonTintColor?: string;\n dismissButtonBackgroundColor?: string;\n dismissButtonTextColor?: string;\n backButtonBackgroundColor?: string;\n backButtonTintColor?: string;\n backButtonTextColor?: string;\n backButtonBorderColor?: string;\n\n // Navigation View\n navigationViewBackgroundColor?: string;\n\n // Distance Label Properties\n distanceLabelUnitTextColor?: string;\n distanceLabelValueTextColor?: string;\n\n // Rating Control\n ratingControlNormalColor?: string;\n ratingControlSelectedColor?: string;\n\n // Steps Properties\n stepsBackgroundViewColor?: string;\n stepsTableHeaderTintColor?: string;\n stepsTableHeaderTextColor?: string;\n stepInstructionsBackgroundColor?: string;\n stepTableViewCellBackgroundColor?: string;\n\n // Next Instruction\n nextInstructionNormalTextColor?: string;\n nextInstructionContainedTextColor?: string;\n\n // Secondary Label Properties\n secondaryLabelNormalTextColor?: string;\n\n // Stylable Label\n stylableLabelNormalTextColor?: string;\n\n // CarPlay Properties\n carPlayCompassBackgroundColor?: string;\n};\n"]}
|
@@ -23,63 +23,6 @@ class CustomDayStyle: StandardDayStyle {
|
|
23
23
|
var customFloatingButtonsBorderColor: UIColor?
|
24
24
|
var customFloatingButtonsTextColor: UIColor?
|
25
25
|
|
26
|
-
// Information Stack (2)
|
27
|
-
var customInformationStackBackgroundColor: UIColor?
|
28
|
-
var customInformationStackTextColor: UIColor?
|
29
|
-
|
30
|
-
// Steps List
|
31
|
-
var customStepsBackgroundColor: UIColor?
|
32
|
-
var customStepsPrimaryTextColor: UIColor?
|
33
|
-
var customStepsSecondaryTextColor: UIColor?
|
34
|
-
var customStepsManeuverViewPrimaryColor: UIColor?
|
35
|
-
var customStepsManeuverViewSecondaryColor: UIColor?
|
36
|
-
var customStepsSeparatorColor: UIColor?
|
37
|
-
|
38
|
-
// Lane View
|
39
|
-
var customLaneViewBackgroundColor: UIColor?
|
40
|
-
var customLaneViewForegroundColor: UIColor?
|
41
|
-
var customLaneViewSeparatorColor: UIColor?
|
42
|
-
|
43
|
-
// Next Banner View
|
44
|
-
var customNextBannerBackgroundColor: UIColor?
|
45
|
-
var customNextBannerPrimaryTextColor: UIColor?
|
46
|
-
var customNextBannerSecondaryTextColor: UIColor?
|
47
|
-
var customNextBannerDistanceTextColor: UIColor?
|
48
|
-
|
49
|
-
// Progress Bar
|
50
|
-
var customProgressBarProgressColor: UIColor?
|
51
|
-
var customProgressBarBackgroundColor: UIColor?
|
52
|
-
|
53
|
-
// Maneuver View
|
54
|
-
var customManeuverViewPrimaryColor: UIColor?
|
55
|
-
var customManeuverViewSecondaryColor: UIColor?
|
56
|
-
var customManeuverViewPrimaryColorHighlighted: UIColor?
|
57
|
-
var customManeuverViewSecondaryColorHighlighted: UIColor?
|
58
|
-
|
59
|
-
// Instructions Card
|
60
|
-
var customInstructionsCardBackgroundColor: UIColor?
|
61
|
-
var customInstructionsCardSeparatorColor: UIColor?
|
62
|
-
var customInstructionsCardHighlightedSeparatorColor: UIColor?
|
63
|
-
|
64
|
-
// Exit View
|
65
|
-
var customExitViewForegroundColor: UIColor?
|
66
|
-
var customExitViewBorderColor: UIColor?
|
67
|
-
var customExitViewHighlightColor: UIColor?
|
68
|
-
|
69
|
-
// Route Shield
|
70
|
-
var customRouteShieldForegroundColor: UIColor?
|
71
|
-
var customRouteShieldBorderColor: UIColor?
|
72
|
-
var customRouteShieldHighlightColor: UIColor?
|
73
|
-
|
74
|
-
// Distance Labels
|
75
|
-
var customDistanceRemainingColor: UIColor?
|
76
|
-
var customDistanceUnitColor: UIColor?
|
77
|
-
var customDistanceValueColor: UIColor?
|
78
|
-
|
79
|
-
// Rating Control
|
80
|
-
var customRatingControlNormalColor: UIColor?
|
81
|
-
var customRatingControlSelectedColor: UIColor?
|
82
|
-
|
83
26
|
required init() {
|
84
27
|
super.init()
|
85
28
|
styleType = .day
|
@@ -165,138 +108,5 @@ class CustomDayStyle: StandardDayStyle {
|
|
165
108
|
// Set default values for floating buttons
|
166
109
|
FloatingButton.appearance(for: traitCollection).borderWidth = 1.0
|
167
110
|
FloatingButton.appearance(for: traitCollection).cornerRadius = 4.0
|
168
|
-
|
169
|
-
// Information Stack
|
170
|
-
if let bgColor = customInformationStackBackgroundColor {
|
171
|
-
StepsBackgroundView.appearance(for: traitCollection).backgroundColor = bgColor
|
172
|
-
}
|
173
|
-
if let textColor = customInformationStackTextColor {
|
174
|
-
StepsTableHeaderView.appearance(for: traitCollection).normalTextColor = textColor
|
175
|
-
}
|
176
|
-
|
177
|
-
// Steps List
|
178
|
-
if let bgColor = customStepsBackgroundColor {
|
179
|
-
StepInstructionsView.appearance(for: traitCollection).backgroundColor = bgColor
|
180
|
-
}
|
181
|
-
if let primaryTextColor = customStepsPrimaryTextColor {
|
182
|
-
PrimaryLabel.appearance(for: traitCollection, whenContainedInInstancesOf: [StepInstructionsView.self])
|
183
|
-
.normalTextColor = primaryTextColor
|
184
|
-
}
|
185
|
-
if let secondaryTextColor = customStepsSecondaryTextColor {
|
186
|
-
SecondaryLabel.appearance(for: traitCollection, whenContainedInInstancesOf: [StepInstructionsView.self])
|
187
|
-
.normalTextColor = secondaryTextColor
|
188
|
-
}
|
189
|
-
if let maneuverPrimaryColor = customStepsManeuverViewPrimaryColor {
|
190
|
-
ManeuverView.appearance(for: traitCollection, whenContainedInInstancesOf: [StepInstructionsView.self])
|
191
|
-
.primaryColor = maneuverPrimaryColor
|
192
|
-
}
|
193
|
-
if let maneuverSecondaryColor = customStepsManeuverViewSecondaryColor {
|
194
|
-
ManeuverView.appearance(for: traitCollection, whenContainedInInstancesOf: [StepInstructionsView.self])
|
195
|
-
.secondaryColor = maneuverSecondaryColor
|
196
|
-
}
|
197
|
-
if let separatorColor = customStepsSeparatorColor {
|
198
|
-
SeparatorView.appearance(for: traitCollection).backgroundColor = separatorColor
|
199
|
-
}
|
200
|
-
|
201
|
-
// Lane View
|
202
|
-
if let bgColor = customLaneViewBackgroundColor {
|
203
|
-
LanesView.appearance(for: traitCollection).backgroundColor = bgColor
|
204
|
-
}
|
205
|
-
if let fgColor = customLaneViewForegroundColor {
|
206
|
-
LaneView.appearance(for: traitCollection).primaryColor = fgColor
|
207
|
-
}
|
208
|
-
if let separatorColor = customLaneViewSeparatorColor {
|
209
|
-
// Apply to lane view separators if available
|
210
|
-
}
|
211
|
-
|
212
|
-
// Next Banner View
|
213
|
-
if let bgColor = customNextBannerBackgroundColor {
|
214
|
-
NextBannerView.appearance(for: traitCollection).backgroundColor = bgColor
|
215
|
-
}
|
216
|
-
if let primaryTextColor = customNextBannerPrimaryTextColor {
|
217
|
-
NextInstructionLabel.appearance(for: traitCollection, whenContainedInInstancesOf: [NextBannerView.self])
|
218
|
-
.normalTextColor = primaryTextColor
|
219
|
-
}
|
220
|
-
if let secondaryTextColor = customNextBannerSecondaryTextColor {
|
221
|
-
// Apply to secondary text in next banner
|
222
|
-
}
|
223
|
-
if let distanceTextColor = customNextBannerDistanceTextColor {
|
224
|
-
DistanceLabel.appearance(for: traitCollection, whenContainedInInstancesOf: [NextBannerView.self])
|
225
|
-
.valueTextColor = distanceTextColor
|
226
|
-
}
|
227
|
-
|
228
|
-
// Progress Bar
|
229
|
-
if let progressColor = customProgressBarProgressColor {
|
230
|
-
// Apply to progress bar progress color
|
231
|
-
}
|
232
|
-
if let bgColor = customProgressBarBackgroundColor {
|
233
|
-
// Apply to progress bar background
|
234
|
-
}
|
235
|
-
|
236
|
-
// Maneuver View
|
237
|
-
if let primaryColor = customManeuverViewPrimaryColor {
|
238
|
-
ManeuverView.appearance(for: traitCollection).primaryColor = primaryColor
|
239
|
-
}
|
240
|
-
if let secondaryColor = customManeuverViewSecondaryColor {
|
241
|
-
ManeuverView.appearance(for: traitCollection).secondaryColor = secondaryColor
|
242
|
-
}
|
243
|
-
if let primaryHighlightedColor = customManeuverViewPrimaryColorHighlighted {
|
244
|
-
ManeuverView.appearance(for: traitCollection).primaryColorHighlighted = primaryHighlightedColor
|
245
|
-
}
|
246
|
-
if let secondaryHighlightedColor = customManeuverViewSecondaryColorHighlighted {
|
247
|
-
ManeuverView.appearance(for: traitCollection).secondaryColorHighlighted = secondaryHighlightedColor
|
248
|
-
}
|
249
|
-
|
250
|
-
// Instructions Card
|
251
|
-
if let bgColor = customInstructionsCardBackgroundColor {
|
252
|
-
InstructionsCardContainerView.appearance(for: traitCollection).customBackgroundColor = bgColor
|
253
|
-
}
|
254
|
-
if let separatorColor = customInstructionsCardSeparatorColor {
|
255
|
-
InstructionsCardContainerView.appearance(for: traitCollection).separatorColor = separatorColor
|
256
|
-
}
|
257
|
-
if let highlightedSeparatorColor = customInstructionsCardHighlightedSeparatorColor {
|
258
|
-
InstructionsCardContainerView.appearance(for: traitCollection).highlightedSeparatorColor = highlightedSeparatorColor
|
259
|
-
}
|
260
|
-
|
261
|
-
// Exit View
|
262
|
-
if let fgColor = customExitViewForegroundColor {
|
263
|
-
ExitView.appearance(for: traitCollection).foregroundColor = fgColor
|
264
|
-
}
|
265
|
-
if let borderColor = customExitViewBorderColor {
|
266
|
-
ExitView.appearance(for: traitCollection).borderColor = borderColor
|
267
|
-
}
|
268
|
-
if let highlightColor = customExitViewHighlightColor {
|
269
|
-
ExitView.appearance(for: traitCollection).highlightColor = highlightColor
|
270
|
-
}
|
271
|
-
|
272
|
-
// Route Shield
|
273
|
-
if let fgColor = customRouteShieldForegroundColor {
|
274
|
-
GenericRouteShield.appearance(for: traitCollection).foregroundColor = fgColor
|
275
|
-
}
|
276
|
-
if let borderColor = customRouteShieldBorderColor {
|
277
|
-
GenericRouteShield.appearance(for: traitCollection).borderColor = borderColor
|
278
|
-
}
|
279
|
-
if let highlightColor = customRouteShieldHighlightColor {
|
280
|
-
GenericRouteShield.appearance(for: traitCollection).highlightColor = highlightColor
|
281
|
-
}
|
282
|
-
|
283
|
-
// Distance Labels
|
284
|
-
if let remainingColor = customDistanceRemainingColor {
|
285
|
-
DistanceRemainingLabel.appearance(for: traitCollection).normalTextColor = remainingColor
|
286
|
-
}
|
287
|
-
if let unitColor = customDistanceUnitColor {
|
288
|
-
DistanceLabel.appearance(for: traitCollection).unitTextColor = unitColor
|
289
|
-
}
|
290
|
-
if let valueColor = customDistanceValueColor {
|
291
|
-
DistanceLabel.appearance(for: traitCollection).valueTextColor = valueColor
|
292
|
-
}
|
293
|
-
|
294
|
-
// Rating Control
|
295
|
-
if let normalColor = customRatingControlNormalColor {
|
296
|
-
RatingControl.appearance(for: traitCollection).normalColor = normalColor
|
297
|
-
}
|
298
|
-
if let selectedColor = customRatingControlSelectedColor {
|
299
|
-
RatingControl.appearance(for: traitCollection).selectedColor = selectedColor
|
300
|
-
}
|
301
111
|
}
|
302
112
|
}
|
@@ -18,6 +18,9 @@ Pod::Spec.new do |s|
|
|
18
18
|
s.dependency 'ExpoModulesCore'
|
19
19
|
s.dependency 'MapboxMaps', ENV['ExpoNavigationMapboxMapsVersion']
|
20
20
|
s.dependency 'Turf', '~> 3.0'
|
21
|
+
s.dependency 'MapboxNavigation', '~> 2.14.0'
|
22
|
+
s.dependency 'MapboxCoreNavigation', '~> 2.14.0'
|
23
|
+
s.dependency 'MapboxDirections', '~> 2.11.0'
|
21
24
|
|
22
25
|
s.source_files = "**/*.{h,m,swift}"
|
23
26
|
s.exclude_files = ["Frameworks/*.xcframework/**/*.h"]
|
@@ -209,209 +209,6 @@ public class ExpoMapboxNavigationModule: Module {
|
|
209
209
|
view.controller.setSpeedLimitBorderColor(hexColor: hexColor)
|
210
210
|
}
|
211
211
|
}
|
212
|
-
|
213
|
-
Prop("stepsBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
214
|
-
if let hexColor = color {
|
215
|
-
view.controller.setStepsBackgroundColor(hexColor: hexColor)
|
216
|
-
}
|
217
|
-
}
|
218
|
-
|
219
|
-
Prop("stepsPrimaryTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
220
|
-
if let hexColor = color {
|
221
|
-
view.controller.setStepsPrimaryTextColor(hexColor: hexColor)
|
222
|
-
}
|
223
|
-
}
|
224
|
-
|
225
|
-
Prop("stepsSecondaryTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
226
|
-
if let hexColor = color {
|
227
|
-
view.controller.setStepsSecondaryTextColor(hexColor: hexColor)
|
228
|
-
}
|
229
|
-
}
|
230
|
-
|
231
|
-
Prop("stepsManeuverViewPrimaryColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
232
|
-
if let hexColor = color {
|
233
|
-
view.controller.setStepsManeuverViewPrimaryColor(hexColor: hexColor)
|
234
|
-
}
|
235
|
-
}
|
236
|
-
|
237
|
-
Prop("laneViewBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
238
|
-
if let hexColor = color {
|
239
|
-
view.controller.setLaneViewBackgroundColor(hexColor: hexColor)
|
240
|
-
}
|
241
|
-
}
|
242
|
-
|
243
|
-
Prop("stepsManeuverViewSecondaryColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
244
|
-
if let hexColor = color {
|
245
|
-
view.controller.customDayStyle.customStepsManeuverViewSecondaryColor = UIColor(hex: hexColor)
|
246
|
-
view.controller.update()
|
247
|
-
}
|
248
|
-
}
|
249
|
-
|
250
|
-
Prop("stepsSeparatorColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
251
|
-
if let hexColor = color {
|
252
|
-
view.controller.customDayStyle.customStepsSeparatorColor = UIColor(hex: hexColor)
|
253
|
-
view.controller.update()
|
254
|
-
}
|
255
|
-
}
|
256
|
-
|
257
|
-
Prop("laneViewForegroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
258
|
-
if let hexColor = color {
|
259
|
-
view.controller.customDayStyle.customLaneViewForegroundColor = UIColor(hex: hexColor)
|
260
|
-
view.controller.update()
|
261
|
-
}
|
262
|
-
}
|
263
|
-
|
264
|
-
// Next Banner View
|
265
|
-
Prop("nextBannerBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
266
|
-
if let hexColor = color {
|
267
|
-
view.controller.setNextBannerBackgroundColor(hexColor: hexColor)
|
268
|
-
}
|
269
|
-
}
|
270
|
-
|
271
|
-
Prop("nextBannerPrimaryTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
272
|
-
if let hexColor = color {
|
273
|
-
view.controller.setNextBannerPrimaryTextColor(hexColor: hexColor)
|
274
|
-
}
|
275
|
-
}
|
276
|
-
|
277
|
-
Prop("nextBannerSecondaryTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
278
|
-
if let hexColor = color {
|
279
|
-
view.controller.setNextBannerSecondaryTextColor(hexColor: hexColor)
|
280
|
-
}
|
281
|
-
}
|
282
|
-
|
283
|
-
Prop("nextBannerDistanceTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
284
|
-
if let hexColor = color {
|
285
|
-
view.controller.setNextBannerDistanceTextColor(hexColor: hexColor)
|
286
|
-
}
|
287
|
-
}
|
288
|
-
|
289
|
-
// Progress Bar
|
290
|
-
Prop("progressBarProgressColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
291
|
-
if let hexColor = color {
|
292
|
-
view.controller.setProgressBarProgressColor(hexColor: hexColor)
|
293
|
-
}
|
294
|
-
}
|
295
|
-
|
296
|
-
Prop("progressBarBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
297
|
-
if let hexColor = color {
|
298
|
-
view.controller.setProgressBarBackgroundColor(hexColor: hexColor)
|
299
|
-
}
|
300
|
-
}
|
301
|
-
|
302
|
-
// Maneuver View
|
303
|
-
Prop("maneuverViewPrimaryColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
304
|
-
if let hexColor = color {
|
305
|
-
view.controller.setManeuverViewPrimaryColor(hexColor: hexColor)
|
306
|
-
}
|
307
|
-
}
|
308
|
-
|
309
|
-
Prop("maneuverViewSecondaryColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
310
|
-
if let hexColor = color {
|
311
|
-
view.controller.setManeuverViewSecondaryColor(hexColor: hexColor)
|
312
|
-
}
|
313
|
-
}
|
314
|
-
|
315
|
-
Prop("maneuverViewPrimaryColorHighlighted") { (view: ExpoMapboxNavigationView, color: String?) in
|
316
|
-
if let hexColor = color {
|
317
|
-
view.controller.setManeuverViewPrimaryColorHighlighted(hexColor: hexColor)
|
318
|
-
}
|
319
|
-
}
|
320
|
-
|
321
|
-
Prop("maneuverViewSecondaryColorHighlighted") { (view: ExpoMapboxNavigationView, color: String?) in
|
322
|
-
if let hexColor = color {
|
323
|
-
view.controller.setManeuverViewSecondaryColorHighlighted(hexColor: hexColor)
|
324
|
-
}
|
325
|
-
}
|
326
|
-
|
327
|
-
// Instructions Card
|
328
|
-
Prop("instructionsCardBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
329
|
-
if let hexColor = color {
|
330
|
-
view.controller.setInstructionsCardBackgroundColor(hexColor: hexColor)
|
331
|
-
}
|
332
|
-
}
|
333
|
-
|
334
|
-
Prop("instructionsCardSeparatorColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
335
|
-
if let hexColor = color {
|
336
|
-
view.controller.setInstructionsCardSeparatorColor(hexColor: hexColor)
|
337
|
-
}
|
338
|
-
}
|
339
|
-
|
340
|
-
Prop("instructionsCardHighlightedSeparatorColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
341
|
-
if let hexColor = color {
|
342
|
-
view.controller.setInstructionsCardHighlightedSeparatorColor(hexColor: hexColor)
|
343
|
-
}
|
344
|
-
}
|
345
|
-
|
346
|
-
// Exit View
|
347
|
-
Prop("exitViewForegroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
348
|
-
if let hexColor = color {
|
349
|
-
view.controller.setExitViewForegroundColor(hexColor: hexColor)
|
350
|
-
}
|
351
|
-
}
|
352
|
-
|
353
|
-
Prop("exitViewBorderColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
354
|
-
if let hexColor = color {
|
355
|
-
view.controller.setExitViewBorderColor(hexColor: hexColor)
|
356
|
-
}
|
357
|
-
}
|
358
|
-
|
359
|
-
Prop("exitViewHighlightColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
360
|
-
if let hexColor = color {
|
361
|
-
view.controller.setExitViewHighlightColor(hexColor: hexColor)
|
362
|
-
}
|
363
|
-
}
|
364
|
-
|
365
|
-
// Route Shield
|
366
|
-
Prop("routeShieldForegroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
367
|
-
if let hexColor = color {
|
368
|
-
view.controller.setRouteShieldForegroundColor(hexColor: hexColor)
|
369
|
-
}
|
370
|
-
}
|
371
|
-
|
372
|
-
Prop("routeShieldBorderColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
373
|
-
if let hexColor = color {
|
374
|
-
view.controller.setRouteShieldBorderColor(hexColor: hexColor)
|
375
|
-
}
|
376
|
-
}
|
377
|
-
|
378
|
-
Prop("routeShieldHighlightColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
379
|
-
if let hexColor = color {
|
380
|
-
view.controller.setRouteShieldHighlightColor(hexColor: hexColor)
|
381
|
-
}
|
382
|
-
}
|
383
|
-
|
384
|
-
// Distance Labels
|
385
|
-
Prop("distanceRemainingColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
386
|
-
if let hexColor = color {
|
387
|
-
view.controller.setDistanceRemainingColor(hexColor: hexColor)
|
388
|
-
}
|
389
|
-
}
|
390
|
-
|
391
|
-
Prop("distanceUnitColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
392
|
-
if let hexColor = color {
|
393
|
-
view.controller.setDistanceUnitColor(hexColor: hexColor)
|
394
|
-
}
|
395
|
-
}
|
396
|
-
|
397
|
-
Prop("distanceValueColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
398
|
-
if let hexColor = color {
|
399
|
-
view.controller.setDistanceValueColor(hexColor: hexColor)
|
400
|
-
}
|
401
|
-
}
|
402
|
-
|
403
|
-
// Rating Control
|
404
|
-
Prop("ratingControlNormalColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
405
|
-
if let hexColor = color {
|
406
|
-
view.controller.setRatingControlNormalColor(hexColor: hexColor)
|
407
|
-
}
|
408
|
-
}
|
409
|
-
|
410
|
-
Prop("ratingControlSelectedColor") { (view: ExpoMapboxNavigationView, color: String?) in
|
411
|
-
if let hexColor = color {
|
412
|
-
view.controller.setRatingControlSelectedColor(hexColor: hexColor)
|
413
|
-
}
|
414
|
-
}
|
415
212
|
}
|
416
213
|
}
|
417
214
|
}
|
@@ -96,6 +96,11 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
96
96
|
|
97
97
|
let customDayStyle = CustomDayStyle()
|
98
98
|
|
99
|
+
private var bottomSheetViewController: UIViewController?
|
100
|
+
private var bottomSheetPanGestureRecognizer: UIPanGestureRecognizer?
|
101
|
+
private var bottomSheetTopConstraint: NSLayoutConstraint?
|
102
|
+
private let bottomSheetHeight: CGFloat = 300 // Adjust this value as needed
|
103
|
+
|
99
104
|
init() {
|
100
105
|
super.init(nibName: nil, bundle: nil)
|
101
106
|
mapboxNavigation = ExpoMapboxNavigationViewController.navigationProvider.mapboxNavigation
|
@@ -417,6 +422,13 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
417
422
|
bottomBanner.distanceFormatter.locale = currentLocale
|
418
423
|
bottomBanner.dateFormatter.locale = currentLocale
|
419
424
|
|
425
|
+
// Add pan gesture recognizer to bottom banner
|
426
|
+
let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handleBottomBannerPan(_:)))
|
427
|
+
bottomBanner.view.addGestureRecognizer(panGesture)
|
428
|
+
|
429
|
+
// Setup bottom sheet
|
430
|
+
setupBottomSheet()
|
431
|
+
|
420
432
|
let navigationOptions = NavigationOptions(
|
421
433
|
mapboxNavigation: self.mapboxNavigation!,
|
422
434
|
voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
|
@@ -479,6 +491,76 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
479
491
|
navigationMapView?.maneuverArrowColor = arrowColor
|
480
492
|
}
|
481
493
|
}
|
494
|
+
|
495
|
+
private func setupBottomSheet() {
|
496
|
+
bottomSheetViewController = UIViewController()
|
497
|
+
guard let bottomSheet = bottomSheetViewController else { return }
|
498
|
+
|
499
|
+
bottomSheet.view.backgroundColor = .white
|
500
|
+
bottomSheet.view.layer.cornerRadius = 16
|
501
|
+
bottomSheet.view.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
|
502
|
+
bottomSheet.view.clipsToBounds = true
|
503
|
+
|
504
|
+
// Add shadow
|
505
|
+
bottomSheet.view.layer.shadowColor = UIColor.black.cgColor
|
506
|
+
bottomSheet.view.layer.shadowOffset = CGSize(width: 0, height: -2)
|
507
|
+
bottomSheet.view.layer.shadowRadius = 3
|
508
|
+
bottomSheet.view.layer.shadowOpacity = 0.2
|
509
|
+
|
510
|
+
addChild(bottomSheet)
|
511
|
+
view.addSubview(bottomSheet.view)
|
512
|
+
bottomSheet.didMove(toParent: self)
|
513
|
+
|
514
|
+
bottomSheet.view.translatesAutoresizingMaskIntoConstraints = false
|
515
|
+
|
516
|
+
// Position bottom sheet initially off screen
|
517
|
+
bottomSheetTopConstraint = bottomSheet.view.topAnchor.constraint(equalTo: view.bottomAnchor)
|
518
|
+
|
519
|
+
NSLayoutConstraint.activate([
|
520
|
+
bottomSheet.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
521
|
+
bottomSheet.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
522
|
+
bottomSheet.view.heightAnchor.constraint(equalToConstant: bottomSheetHeight),
|
523
|
+
bottomSheetTopConstraint!
|
524
|
+
])
|
525
|
+
|
526
|
+
// Add some sample content to the bottom sheet
|
527
|
+
let label = UILabel()
|
528
|
+
label.text = "Bottom Sheet Content"
|
529
|
+
label.textAlignment = .center
|
530
|
+
|
531
|
+
bottomSheet.view.addSubview(label)
|
532
|
+
label.translatesAutoresizingMaskIntoConstraints = false
|
533
|
+
NSLayoutConstraint.activate([
|
534
|
+
label.centerXAnchor.constraint(equalTo: bottomSheet.view.centerXAnchor),
|
535
|
+
label.topAnchor.constraint(equalTo: bottomSheet.view.topAnchor, constant: 20)
|
536
|
+
])
|
537
|
+
}
|
538
|
+
|
539
|
+
@objc private func handleBottomBannerPan(_ gesture: UIPanGestureRecognizer) {
|
540
|
+
let translation = gesture.translation(in: view)
|
541
|
+
let velocity = gesture.velocity(in: view)
|
542
|
+
|
543
|
+
switch gesture.state {
|
544
|
+
case .changed:
|
545
|
+
// Update bottom sheet position based on pan
|
546
|
+
let newConstant = view.frame.height - bottomSheetHeight + translation.y
|
547
|
+
bottomSheetTopConstraint?.constant = min(view.frame.height, max(newConstant, view.frame.height - bottomSheetHeight))
|
548
|
+
|
549
|
+
case .ended:
|
550
|
+
// Determine whether to show or hide based on velocity and position
|
551
|
+
let shouldShow = velocity.y < 0 || bottomSheetTopConstraint?.constant ?? 0 < view.frame.height - bottomSheetHeight/2
|
552
|
+
|
553
|
+
UIView.animate(withDuration: 0.3, delay: 0, options: .curveEaseOut) {
|
554
|
+
self.bottomSheetTopConstraint?.constant = shouldShow ?
|
555
|
+
self.view.frame.height - self.bottomSheetHeight :
|
556
|
+
self.view.frame.height
|
557
|
+
self.view.layoutIfNeeded()
|
558
|
+
}
|
559
|
+
|
560
|
+
default:
|
561
|
+
break
|
562
|
+
}
|
563
|
+
}
|
482
564
|
}
|
483
565
|
extension ExpoMapboxNavigationViewController: NavigationViewControllerDelegate {
|
484
566
|
func navigationViewController(_ navigationViewController: NavigationViewController, didRerouteAlong route: Route) {}
|
package/package.json
CHANGED
@@ -100,7 +100,7 @@ export type ExpoMapboxNavigationViewProps = {
|
|
100
100
|
maneuverViewSecondaryColorHighlighted?: string;
|
101
101
|
|
102
102
|
// Instructions View
|
103
|
-
instructionsTextColor?: string;
|
103
|
+
instructionsTextColor?: string; // Color for all instruction text
|
104
104
|
instructionsBackgroundColor?: string; // Background color for instruction panels
|
105
105
|
|
106
106
|
// Instructions Card
|