[Bug]: Event handlers not called in web environment
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 2.9k
- Forks
- 947
- Avg merge
- 6d 37m
- Merged PRs (30d)
- 1
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the standalone TypeScript reproduction in the issue and run it in Expo Web, then compare its event behavior with Android using the stated versions. Trace the MapView onCameraChanged and onMapIdle entry points; done means both callbacks fire with location updates on Expo Web as they do on Android.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- frontend, mobile-dev, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100