googlemaps / react-native-navigation-sdk

Apache License 2.0
25 stars 4 forks source link

Multiple maps screen in Example app not working #233

Open nexttrack07 opened 2 months ago

nexttrack07 commented 2 months ago

SDK Version: 0.4.3 OS: iOS 17.5 (iPhone 15 Pro simulator)

When opening the multiple maps screen in the example app, the map is stuck in Europe and none of the callbacks are called (no - console.logs seen in terminal). Occasionally there is a popup with error message saying that location is disabled. Also in this case, the RouteStatus is 5 (Location Unknown).

This issue only happens when going directly to the multiple maps screen. If the navigation screen was visited first then the maps work correctly in the multiple maps screen.

Even when setting the location manually, this issue still occurs:

const onMap1Ready = useCallback(async () => {
    console.log('Map is ready, initializing navigator...');
    try {
      await navigationController.init();
      mapViewController1?.setMyLocationEnabled(true);
    } catch (error) {
      console.error('Error initializing navigator', error);
      showSnackbar('Error initializing navigator');
    }
  }, [navigationController, mapViewController1]);
Screenshot 2024-08-23 at 12 19 00 PM Screenshot 2024-08-23 at 12 19 18 PM Screenshot 2024-08-23 at 12 24 59 PM
akilakumarasamy commented 2 months ago

We are seeing this issue in our application after upgrade and this is completely blocking the features on the map, as the location is Disabled and this is happens at random.

jokerttu commented 2 months ago

@nexttrack07 Thank you for reporting this!

The issue arises from how mapViewCallbacks are currently handled in the plugin. When a second map2 view instance is initialized, it overrides the existing callbacks of map1.

Moving the onMapReady callback to map2 callbacks, will trigger the onMapReady call and initializes the navigation.

This is a clear bug, and we are prioritizing more robust callback handling for multiple simultaneous maps.

jokerttu commented 2 months ago

Hi @nexttrack07 Please check PR #239, and let me know if it resolves this issue.

nexttrack07 commented 2 months ago

Hi @jokerttu - Looks like issue is still persisting for me

https://github.com/user-attachments/assets/4a3529ce-560e-4328-a982-39f2b79b40b9