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]: Can not disable mapbox user interactions/ gestures - pan, rotate, pinch to zoom #3783

Open
whoiscarlo opened this issue Feb 20, 2025 · 2 comments
Labels
bug 🪲 Something isn't working

Comments

@whoiscarlo
Copy link

whoiscarlo commented Feb 20, 2025

Mapbox Implementation

Mapbox

Mapbox Version

10.19.3

React Native Version

0.76.7

Platform

iOS

@rnmapbox/maps version

10.1.36

Standalone component to reproduce

import React from 'react';
import Mapbox, {
	Camera,
	MapView,
	SymbolLayer,
} from '@rnmapbox/maps';


export default function App() {
	return (<MapView style={{
			flex: 1,
			width: '100%',
			height: 200,
		}}

		scrollEnabled={false}
		rotateEnabled={false}
		pitchEnabled={false}
		compassEnabled={false}
		scaleBarEnabled={false}
		gestureSettings={{
			rotateEnabled: false,
			simultaneousRotateAndPinchZoomEnabled: false,
			rotateDecelerationEnabled: false,
			pinchPanEnabled: false,
			doubleTouchToZoomOutEnabled: false,
			doubleTapToZoomInEnabled: true,
			panEnabled: false,
		}} >
		<Camera
			defaultSettings={{
				centerCoordinate: [
					-21.827774,
					64.128288
				],
				heading: 0,
				pitch: 0,
			}}
			animationMode="none"
			animationDuration={0}
			zoomLevel={10}
			heading={0}
			pitch={0}
			minZoomLevel={8}
			maxZoomLevel={18}
		/>

		<SymbolLayer id="poi-labels"
			style={{ visibility: "none" }} />
	</MapView>);
}

Observed behavior and steps to reproduce

On iOs the user can pan, rotate, or pinch zoom the map.

Expected behavior

User should not be able to pan, rotate or pinch zoom the map.

Notes / preliminary analysis

I've tried every combination that I can think of but I can't disable any of the user gestures, especially map rotation and pan.

Is anyone else experiencing the same thing on iOS or Android? Or did I setup something up incorrectly?

Someone suggested to use the hack of wrapping the MapView in a View component and changing the style to pointer-events: none; and I can use that for the time being but it's feel pretty wrong.

Additional links and references

No response

@whoiscarlo whoiscarlo added the bug 🪲 Something isn't working label Feb 20, 2025
@flessard
Copy link

@whoiscarlo If you use New Arch on your projet.

https://github.com/rnmapbox/maps/pull/3730

@whoiscarlo
Copy link
Author

@flessard the link doesn't show anything on the page it goes to. But I read up on the New Arch here: https://docs.expo.dev/guides/new-architecture/ and added it to the app.config.ts like so:

{
	ios: {
		newArchEnabled: true,
		supportsTablet: true,
	},
	android: {
		newArchEnabled: true,
	}
}

But still I can rotate and pan across the map on my iOS phone.

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

2 participants