Skip to content

Commit

Permalink
Add onRoutesLoaded callback to android
Browse files Browse the repository at this point in the history
  • Loading branch information
YoussefHenna committed Nov 11, 2024
1 parent 0e69f1e commit f15a332
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ExpoMapboxNavigationModule : Module() {
}

View(ExpoMapboxNavigationView::class) {
Events("onRouteProgressChanged", "onCancelNavigation", "onWaypointArrival", "onFinalDestinationArrival", "onRouteChanged", "onUserOffRoute")
Events("onRouteProgressChanged", "onCancelNavigation", "onWaypointArrival", "onFinalDestinationArrival", "onRouteChanged", "onUserOffRoute", "onRoutesLoaded")

Prop("coordinates") { view: ExpoMapboxNavigationView, coordinates: List<Map<String, Any>> ->
val points = mutableListOf<Point>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class ExpoMapboxNavigationView(context: Context, appContext: AppContext) : ExpoV
private val onFinalDestinationArrival by EventDispatcher()
private val onRouteChanged by EventDispatcher()
private val onUserOffRoute by EventDispatcher()
private val onRoutesLoaded by EventDispatcher()

private val mapboxNavigation = MapboxNavigationApp.current()
private var mapboxStyle: Style? = null
Expand Down Expand Up @@ -590,6 +591,7 @@ class ExpoMapboxNavigationView(context: Context, appContext: AppContext) : ExpoV
}

private fun onRoutesReady(routes: List<NavigationRoute>){
onRoutesLoaded(mapOf())
mapboxNavigation?.setNavigationRoutes(routes)
mapboxNavigation?.startTripSession(withForegroundService=false)
navigationCamera.requestNavigationCameraToFollowing(
Expand Down
1 change: 1 addition & 0 deletions src/ExpoMapboxNavigation.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ export type ExpoMapboxNavigationViewProps = {
onFinalDestinationArrival?: () => void;
onRouteChanged?: () => void;
onUserOffRoute?: () => void;
onRoutesLoaded?: () => void;
style?: StyleProp<ViewStyle>;
};

0 comments on commit f15a332

Please sign in to comment.