homeeondemand / react-native-mapbox-navigation

A navigation UI ready to drop into your React Native application
MIT License
153 stars 118 forks source link

How to display speed limit on navigation map? #90

Open krunal-sisnolabs opened 2 years ago

krunal-sisnolabs commented 2 years ago

I want to add speed limit in my app. I refer these https://docs.mapbox.com/android/navigation/guides/ui-components/speed-limit/ https://docs.mapbox.com/android/navigation/examples/show-speed-limit/

but it give me error this error "Type mismatch: inferred type is MapboxNavigationView but Context was expected" for below code.

// Define speed limit formatter options private val speedLimitFormatter: SpeedLimitFormatter by lazy { SpeedLimitFormatter(this) }

for SpeedLimitFormatter variable

Can you please help me how to add speed limit code in MapboxNavigationView.kt file.

krunal-sisnolabs commented 2 years ago

Hi, I solved it myself. replace "this" with "context"

Code : // Define speed limit formatter options private val speedLimitFormatter: SpeedLimitFormatter by lazy { SpeedLimitFormatter(context) }

Now speed limit is worked on my navigation map.