React-native-map-navigation Support

#1

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!

#2

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

#3

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?

#4

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}`);
    }
  };
}
#5

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

#6

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

#7

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

closed #8

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