googlemaps / react-native-navigation-sdk

Apache License 2.0
25 stars 5 forks source link

Add Support for Classic Google MapView as Separate Component #254

Closed jokerttu closed 1 month ago

jokerttu commented 1 month ago

Background

Currently, the package supports creating NavigationView, which displays Google Maps with navigation routes using the native Google Navigation SDK views. However, developers have expressed the need to display a classic Google Map without initiating navigation or showing existing routes. Since the Navigation SDK includes the Google Maps SDK, integrating other plugins for a classic MapView can lead to conflicts. Therefore, it would be beneficial for developers to have the ability to display a classic map within this package.

To address this, a separate MapView component should be implemented, allowing the classic map to be displayed without any effects from an ongoing or initialized navigation session. Although NavigationView can be used without navigation, it remains tied to the navigation state, preventing the display of a classic map once navigation is initialized. The new MapView component will bypass this limitation, sharing the same MapController as NavigationView but without showing any navigation-related information or being affected by changes in the navigation state.

Implementation

Android:

iOS:

These changes will ensure that both platforms handle the new MapView component independently from the navigation state, providing developers with the flexibility to use a classic map when needed.

Workaround:

Until this new MapView component is implemented, developers can display a classic map view using a workaround, though it's not a perfect solution.

[!NOTE]
Since NavigationView and MapView will be separate components, transitioning between navigation and classic map views cannot be done seamlessly. If the view is intended to display navigation routes at any point, it is recommended to use NavigationView consistently to avoid interruptions in the navigation state.