bramus / react-native-maps-directions

Directions Component for `react-native-maps`
MIT License
1.25k stars 198 forks source link

Can't see the directions on iOS #16

Closed german-bortoli closed 6 years ago

german-bortoli commented 6 years ago

I am unable to see directions on iOS, I am using a child element on parent map, to generate markers and get them directions.

Somehow it shows me the markers but not the directions (Btw onReady event works perfectly)

bramus commented 6 years ago

Hi @Germanaz0, have you set a strokeWidth or strokeColor prop?

german-bortoli commented 6 years ago

Hi @bramus yes both, I can see it properly on Android but not on iOS :S

bramus commented 6 years ago

Hmmz, That's weird indeed. Let's see:

german-bortoli commented 6 years ago

react-native: 0.50.3 react-native-maps

About the second question, am not pretty sure, I can view the markers, I have to run a test, I can give you that information in a few of hours.

german-bortoli commented 6 years ago

Yes if I draw a polyline in the same state, it does works, but does not using the package.

bramus commented 6 years ago

Perhaps there's no route available between the two points? Could you share those coordinates? Then I can test myself (and provide a fallback in case that happens).

Additionally, for testing, what happens when you enter the coordinates from the example?

const origin = {latitude: 37.3318456, longitude: -122.0296002};
const destination = {latitude: 37.771707, longitude: -122.4053769};
hatyaiapp commented 6 years ago

me too, it's work fine in android with same coordinates

bramus commented 6 years ago

@hatyaiapp I'll need some more info:

  1. Between which two points are you routing?
  2. Which version of react-native are you using?
  3. Which version of react-native-maps are you using?

B!

hatyaiapp commented 6 years ago

@bramus

  1. I use your example coordinates {latitude: 37.3318456, longitude: -122.0296002} and {latitude: 37.771707, longitude: -122.4053769}
  2. react-native v0.53.0
  3. react-native-maps v0.20.0
bramus commented 6 years ago

OK, I have a working combo of RN 0.53 and react-native-maps 0.16.4 here (the version before it was handed over from AirBnB by the React Community). Will need to check what 0.20 gives me.

bramus commented 6 years ago

I've now tested react-native-maps-directions with the following react-native and react-native-maps combinations:

They all work fine (iPhone 8 Plus, iOS 11.2, MapKit, Simulator) …

Can someone provide me some demo code (or a repo) that reproduces this problem?

german-bortoli commented 6 years ago

@bramus could be that this wont work if it is a child component of the map, and has some conditions to be rendered ?

What I do not understand is why on android works fine

bramus commented 6 years ago

As I cannot reproduce it: can you share a standalone piece of code in which things go wrong? Without it I won't be able to do that much and will be closing this issue some time in the future …

german-bortoli commented 6 years ago

Yes, I need a bit of time only to generate a seed or something

bramus commented 6 years ago

Awesome! Looking forward to it :)

bramus commented 6 years ago

Closing due to inactivity / insufficient information.

Feel free to add some more info and I'll gladly reopen.

veralex commented 6 years ago

I'm not able to draw a route on iPhone either. Android device works fine. That's my code and I see only a marker: <View> <MapViewDirections origin={this.getEndPoint()} destination={this.state.destination} apikey={Keys.DirectionsApiKey} strokeWidth={4} strokeColor="#000" mode={'walking'} <MapView.Marker coordinate={this.state.destination} anchor={{x: 0.42, y: 0.49}}> <View style={styles.routeEnd}></View> </MapView.Marker> </View>

This code <MapView.Polyline coordinates={this.getRideTracks()} strokeColor="#FF1943" strokeWidth={4} /> inside my MapView component works fine

veselinnguyen commented 5 years ago

@Bramus What is the free amount of directions that can be performed without the new Google API paid Application KEY ? When I try to do directions I see an error that something went wrong and the direction cannot be loaded.

bramus commented 5 years ago

@veselinnguyen See Google's own Directions API Usage and Billing page for info on their pricing.

koo27 commented 5 years ago

I know it's old and closed, but I had the same issue. Basically you can't wrap the Map Directions in a View on iOS. https://github.com/bramus/react-native-maps-directions/issues/113

zaguiini commented 4 years ago

Thanks @koo27!!!

gustavoccintrao commented 2 years ago

Thank you @koo27 !