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:
A MapFragment should be used in place of SupportNavigationFragment when displaying the classic MapView.
The native view manager for NavigationView should be updated to handle the creation of either MapFragment or NavigationFragment, based on whether a classic map or navigation is required. This will be done by sending a type flag through the createFragment method.
iOS:
On iOS, the same GMSMapView component can be reused for the classic map view. However, when using the new MapView, the navigation session will not be attached to the map, allowing it to function as a regular Google Map without showing navigation routes or being influenced by the navigation state. View type is controlled by sending a type flag through the createFragment method
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.
On Android, the ongoing navigation session must be cleared, and the NavigationViewController method setNavigationUIEnabled(false) should be called. This disables the navigation UI and allows the map to function without showing navigation routes.
On iOS, the setNavigationUIEnabled(false) method can be used without clearing the navigation session, as it hides the navigation route as well while keeping the session active, allowing the map to be displayed as a classic map.
[!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.
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 classicMapView
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. AlthoughNavigationView
can be used without navigation, it remains tied to the navigation state, preventing the display of a classic map once navigation is initialized. The newMapView
component will bypass this limitation, sharing the sameMapController
asNavigationView
but without showing any navigation-related information or being affected by changes in the navigation state.Implementation
Android:
A
MapFragment
should be used in place ofSupportNavigationFragment
when displaying the classicMapView
.The native view manager for
NavigationView
should be updated to handle the creation of eitherMapFragment
orNavigationFragment
, based on whether a classic map or navigation is required. This will be done by sending a type flag through thecreateFragment
method.iOS:
GMSMapView
component can be reused for the classic map view. However, when using the newMapView
, the navigation session will not be attached to the map, allowing it to function as a regular Google Map without showing navigation routes or being influenced by the navigation state. View type is controlled by sending a type flag through thecreateFragment
methodThese 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.
On Android, the ongoing navigation session must be cleared, and the
NavigationViewController
methodsetNavigationUIEnabled(false)
should be called. This disables the navigation UI and allows the map to function without showing navigation routes.On iOS, the
setNavigationUIEnabled(false)
method can be used without clearing the navigation session, as it hides the navigation route as well while keeping the session active, allowing the map to be displayed as a classic map.