Skip to content

map v7 is not clickable or draggable in android #76

@rodrigues86

Description

@rodrigues86

Bug Report

Plugin(s)

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21"
classpath 'com.android.tools.build:gradle:8.7.1'
classpath 'com.google.gms:google-services:4.4.1'

Capacitor Version

"@capacitor/android": "^7.0.1",
"@capacitor/app": "^7.0.0",
"@capacitor/camera": "^7.0.0",
"@capacitor/core": "^7.0.1",
"@capacitor/device": "^7.0.0",
"@capacitor/geolocation": "^7.1.1",
"@capacitor/google-maps": "^7.0.1",
"@capacitor/cli": "^7.0.1",

Platform(s)

node 20.18.3
android 14 (device testing)
@ionic/react: 8.0.0
JavaVersion.VERSION_21

Current Behavior

When open the map on android device and the user click or drag map, the app closes no errors. In android emulator is ok

Expected Behavior

Map clickable and draggable

Code Reproduction

  const mapRef = useRef<HTMLElement>(null);
  const [map, setMap] = useState<GoogleMap | null>(null);

GoogleMap.create({
          id: "rr-map",
          element: mapRef.current,
          apiKey: import.meta.env.KEY,
          config: {
            center: coordinate,
            zoom: 15,
            clickableIcons: true,
            fullscreenControl: true,
          },
        })
          .then((googleMaps: GoogleMap) => {
            console.log("googleMaps", googleMaps);
            console.log("mapRef", mapRef);

            if (isNative) {
              googleMaps.enableCurrentLocation(true);
              googleMaps.enableTouch();
              googleMaps.enableAccessibilityElements(true);
            }

            googleMaps.setOnMapClickListener((data) => {
              try {
                showToast({
                  message: `${data.latitude}, ${data.longitude}`,
                  duration: 3000,
                  color: "success",
                });
              } catch (error) {
                console.error("Error onMapClick:", error);
              }
            });

            googleMaps.addMarker({
              coordinate,
              title: profile.name,
            });

            setMap(googleMaps);

          })

Other Technical Details

vs code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions