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

Popups do not open when clicked #102

Closed
bsudekum opened this issue Oct 16, 2015 · 24 comments
Closed

Popups do not open when clicked #102

bsudekum opened this issue Oct 16, 2015 · 24 comments
Labels

Comments

@bsudekum
Copy link

Even when hard coding a point seen below, the popup still does not open when clicked

view.addMarker(new MarkerOptions()
  .position(new LatLng(48.13863, 11.57603))
  .title("Hello World!")
  .snippet("Welcome to my marker."));

/cc @bleege

@Iragne
Copy link

Iragne commented Nov 25, 2015

any news on it ?

@bsudekum
Copy link
Author

Stranger yet, the annotations are only clickable after rotating the screen.

@bleege
Copy link

bleege commented Dec 18, 2015

Is this using version 2.3.0?

@bsudekum
Copy link
Author

Comment #102 (comment) is using 2.3.0

@bleege
Copy link

bleege commented Dec 18, 2015

@bsudekum Thanks for confirming. Are other Gestures (double tap, fling, long press, etc) functioning as expected or are they not responding either? The reason I ask is that the MapView selects the Marker and opens the InfoWindow inside it's primary single finger Gesture listener object.

@erwan
Copy link

erwan commented Dec 28, 2015

Same problem here with 3.0.0, with an "annotation" property I have the marker but no InfoWindow on click. Zooming, rotating, etc work. Even after rotation I still have to info window.

@erwan
Copy link

erwan commented Jan 9, 2016

Do anyone has it working, and have clickable annotations on Android?

@ingwet
Copy link

ingwet commented Jan 16, 2016

Facing same problems, would appreciate any feedback on that

@tobrun
Copy link
Contributor

tobrun commented Jan 21, 2016

Looking into this:

Currently noticing this during debugging:

  • OnMarkerClicked callback is not invoked when we click a marker.
  • OnMapLongClick callback is invoked when we long click the map.

I will have to debug deeper in the Android SDK to see what is going wrong.

@tobrun
Copy link
Contributor

tobrun commented Jan 21, 2016

During a second round of debugging, I'm noticing that OnMarkerClicked callback is invoked just once and afterwards never again since that marker remains in the list of mSelectedMarkers. I was able to debug to the code for showing an InfoWindow. I need to investigate why this is not showing, I initially thought the problem would be related to click handling.

@tobrun
Copy link
Contributor

tobrun commented Jan 21, 2016

To make it even more weird:

This happens when you click an annotation and rotate the device:
screen shot 2016-01-21 at 12 22 32

Even more strange if deselected and reactivated:
screen shot 2016-01-21 at 12 22 40

@tobrun
Copy link
Contributor

tobrun commented Jan 21, 2016

The reason why it's is shown the second time will probably be related to this method in onCreate:

 private void adjustTopOffsetPixels() {
        int count = mAnnotations.size();
        for (int i = 0; i < count; i++) {
            Annotation annotation = mAnnotations.get(i);
            if (annotation instanceof Marker) {
                Marker marker = (Marker) annotation;
                marker.setTopOffsetPixels(
                        getTopOffsetPixelsForSprite(marker.getIcon()));
            }
        }

        for (Marker marker : mSelectedMarkers) {
            if (marker.isInfoWindowShown()) {
                Marker temp = marker;
                temp.hideInfoWindow();
                temp.showInfoWindow();
                marker = temp;
            }
        }
    }

Edit:
I have tried executing this method with a delayed handler using reflection but this didn't show the InfoWindow as I suspected it would.

Edit 2:
I'm now noticing the react native configuration for handling orientation which is by default onConfigChanges which will not trigger a call to onCreate.

@tobrun
Copy link
Contributor

tobrun commented Jan 21, 2016

I'm going to try 2 things now,

  • Properly configure MapView with the different lifecycle events
    • Edit: this is not possible, ReactNative does its config after onResume
  • Debug ReactNative core code to see what happens with orientation change
    • Edit: orientation change is not recreating the Activity -> configChanges config

@gundersen
Copy link

@tobrun @zugaldia -- how important is opening annotation popups before we blog this? cc @bsudekum

@tobrun
Copy link
Contributor

tobrun commented Feb 1, 2016

@gundersen
I feel it's pretty important, I'm not confident calling this a v1.0 release because I'm unable to give you an estimation for the solution or the impact it will have on current architecture. If you want to blog I'm suggesting calling the Android SDK a beta or pre-release version.

@bsudekum
Next steps to resolve this issue would be to reimplementing the Android code based on this GoogleMaps ReactNative library. Currently my schedule is being prioritised in favour of Android 4.0.0 release work.

cc @zugaldia

@zugaldia
Copy link
Contributor

zugaldia commented Feb 2, 2016

@gundersen @tobrun per voice with @bsudekum today there're two significant blocker issues before we're ready for prime time. This and mapbox/mapbox-gl-native#3584. We're looking into them.

@zugaldia
Copy link
Contributor

zugaldia commented Feb 3, 2016

@jayfunk
Copy link
Contributor

jayfunk commented Mar 1, 2016

I am still experiencing this issue in the latest release. #293 It appears that if I add another element which changes the map dimensions the popup displays but it will render the popup in the incorrect position depending on how much the map is resized.

@ghost
Copy link

ghost commented May 18, 2016

@bsudekum Will #313 be merged any time soon? I was able to fix this issue on mapboxgl 4.0

I am currently working on allowing react components to be rendered as InfoWindows but once done I will make a new pull request for this issue.

screencast

@bsudekum
Copy link
Author

bsudekum commented May 18, 2016

@AlexLourenco this is awesome! I have a local branch that incorporates v4 but I was not able to fix this bug, so no plans to merge any time soon.

@dominicmh
Copy link

For now, the only way to get this working is by registering to the DeviceEventEmitter like so:
DeviceEventEmitter.addListener('onOpenAnnotation', this.onOpenAnnotation);

Is that right or did I miss something?

@afischer
Copy link
Contributor

Any word on this? Currently having this issue with the latest releases.

@dapetcu21
Copy link
Collaborator

I implemented a workaround for this issue in 5.0.0. It's now fixed in master. Every time an annotation gets clicked, I manually trigger a relayout of the annotation view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests