React-native-map-navigation Support

Hi,

I’m new to react native and expo, but knows how to get basic things done.
My question is how can I use react-native-map-navigation with expo?

I see that expo supports react-native-maps already but does it also include the navigation module or I have to manually install it via npm?

Basically how can I use it in general thanks!

Hey @iamsomeone,

You would have to eject and use ExpoKit to use that library as it requires you to run react-native link to make the necessary native code configurations. Also, the README indicates it’s under heavy development and may change quickly so using it in production is at your own risk.

You can read about ejecting here: https://docs.expo.io/versions/v30.0.0/expokit/eject

Cheers,

Adam

Ok thanks could I somehow use just the react native maps already in expo and link it to google maps turn by turn directions in some way?

You can use Linking to open up apple/google maps. Here’s an example where you pass the address, postal code and city to get directions.

_handlePressDirections = () => {
    let { address, postalCode, city } = this.props.target;

    let daddr = encodeURIComponent(`${address} ${postalCode}, ${city}`);

    if (Platform.OS === 'ios') {
      Linking.openURL(`http://maps.apple.com/?daddr=${daddr}`);
    } else {
      Linking.openURL(`http://maps.google.com/?daddr=${daddr}`);
    }
  };
}

AWESOME OMG THANKS. Btw is there like a way to go back to the app or something or just we have to manually click the back button on the navigation?

Thanks

You’ll have to manually go back to the app.

Ok can you give me an example daddr string? I just want to know the format thanks…

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.