Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return the Lat/Lng coords of the photosphere as you move though the map #36

Merged
merged 6 commits into from
Apr 23, 2020

Conversation

MichaelTaylor3D
Copy link
Contributor

This PR makes the onSuccess callback possible on android, and it returns the lat and lng in the callback for the photosphere every time you move.

    <View style={styles.container}>
      <StreetView
        style={styles.streetView}
        allGesturesEnabled={true}
        coordinate={{
          latitude: 39.151607, 
          longitude: -76.859979,
        }}
        pov={{
          tilt: parseFloat(0),
          bearing: parseFloat(0),
          zoom: parseInt(1),
        }}
        onSuccess={(data) => console.log(data.nativeEvent)}
      />
    </View>

image

@@ -83,9 +85,12 @@ public void onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera streetView
panorama.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
@Override
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation) {
if (streetViewPanoramaLocation != null && streetViewPanoramaLocation.links != null ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasnt sure why its looking for links but it was preventing the link from firing when otherwise a change was made. I can add an extra if statement if there is something special we want to handle for this case.

@@ -51,8 +51,8 @@ public void setPov(NSTStreetView view, ReadableMap pov) {
public @Nullable
Map getExportedCustomDirectEventTypeConstants() {
return MapBuilder.of(
NSTStreetViewEvent.eventNameForType(NSTStreetViewEvent.ON_ERROR), MapBuilder.of("registrationName", "onStreetViewError"),
Copy link
Contributor Author

@MichaelTaylor3D MichaelTaylor3D Apr 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed to me the reason the onSuccess Callback wasnt working is because the event names were mismatched. So with this change I made it all the same as whats in the NSTStreetViewEvent.

@amitpdev amitpdev merged commit 99bd9a0 into nesterapp:master Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants