homeeondemand / react-native-mapbox-navigation

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

Getting an event on clicking the cross icon? #4

Closed shahraizali closed 3 years ago

shahraizali commented 3 years ago

Screenshot

how to get an event by clicking on that cross or is there any other way of closing it?

Thank You

rossmartin commented 3 years ago

I haven't implemented a callback for that yet and on iOS I chose to manually hide it for now. I think in a future release I'd like to add an onCancel prop that will get triggered when you click that "X" to stop navigation. I will also need to add an imperative way for you to cancel navigation via the MapboxNavigation react ref.

Here is the stubbed in listener on android - https://github.com/homeeondemand/react-native-mapbox-navigation/blob/master/android/src/main/java/com/homee/mapboxnavigation/MapboxNavigationView.kt#L164

I'll leave this thread opened until this is implemented.

shahraizali commented 3 years ago

Hey! @rossmartin Created a PR for onCancelNavigation. it has fulfilled my requirement I am able to do this now

<MapboxNavigation
    onError={(event) => { const { message } = event.nativeEvent; }}
    onCancelNavigation={(event)=>{ #HERE PERFORM MY ACTION }}>
</MapboxNavigation>       

NOTE: I am not a Native developer so If there is something wrong with my implementation kindly do point it out. Thank You.

rossmartin commented 3 years ago

Hey thank you for the contribution. I'd like to get this added in for iOS as well before releasing the next version. I'll either add onto your PR or merge it and add this for iOS separately. I should have some time this weekend.

shahraizali commented 3 years ago

sounds good on a separate note any plan on adding theme specification like light or dark?

rossmartin commented 3 years ago

I wasn't planning on it yet but you should be able to customize the day and night theme on android - https://docs.mapbox.com/android/navigation/guides/styles/

The library should be changing to night mode automatically when necessary.

rossmartin commented 3 years ago

I had time tonight so I merged #5, implemented onCancelNavigation for iOS, and documented it. This is all in 0.2.0.

Thanks again.

shahraizali commented 3 years ago

Perfect! as for the colors I wanted to change the blue header of turn by turn nav. I know the map is adaptive of local dark mode but the header color I wanted to make it white couldn't figure out how to go about that.

yabutagf commented 3 years ago

@shahraizali are you able to change the blue header of turn by turn nav?

viniengelage commented 3 years ago

Some news about this topic? i want to change nav color too