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

[Bug]: Event handlers not called in web environment #3597

Open
Jaza opened this issue Aug 26, 2024 · 1 comment
Open

[Bug]: Event handlers not called in web environment #3597

Jaza opened this issue Aug 26, 2024 · 1 comment
Labels
bug 🪲 Something isn't working

Comments

@Jaza
Copy link

Jaza commented Aug 26, 2024

Mapbox Implementation

Mapbox

Mapbox Version

default

React Native Version

0.74.1

Platform

Android

@rnmapbox/maps version

10.1.28

Standalone component to reproduce

import React from 'react';
import { useState } from 'react';
import {
  MapState,
  MapView,
  Camera,
} from '@rnmapbox/maps';

const BugReportExample = () => {
  const [_mapState, setMapState] = useState<MapState>({
    properties: {
      center: [0, 0],
      bounds: {
        ne: [0, 0],
        sw: [0, 0],
      },
      zoom: 0,
      heading: 0,
      pitch: 0,
    },
    gestures: {
      isGestureActive: false,
    },
  });

  return (
    <MapView
      style={{flex: 1}}
      onCameraChanged={(_state) => {
        setMapState(_state);
        alert(`${_mapState.properties.center}`);
      }}
      onMapIdle={(_state) => {
        setMapState(_state);
        alert(`${_mapState.properties.center}`);
      }}
    >
      <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
    </MapView>
  );
};

Observed behavior and steps to reproduce

In Android (Expo app, development build - not Expo Go, not EAS - running in Android Emulator, or running on physical device via USB debugging / adb): alerts appear with correct map location on initial load and on pan / zoom, onCameraChanged / onMapIdle appear to be getting triggered.

In Expo Web: no alerts appear, onCameraChanged / onMapIdle appear to NOT be getting triggered.

Expected behavior

Should be the same in Expo Web as it is in Android, i.e. onCameraChanged / onMapIdle should get triggered.

Notes / preliminary analysis

No response

Additional links and references

Also reported (not by me) at: https://stackoverflow.com/questions/78625575/mapbox-from-rnmapbox-event-handlers-are-not-called-on-web

@ydrea
Copy link

ydrea commented Sep 28, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@Jaza @ydrea and others