rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.28k stars 848 forks source link

[Bug]: Disabling rotation in gestureSettings doesn't work on iOS #3675

Closed Elter71 closed 3 weeks ago

Elter71 commented 3 weeks ago

Mapbox Implementation

Mapbox

Mapbox Version

10.19.0

React Native Version

0.76.0

Platform

iOS

@rnmapbox/maps version

10.1.33

Standalone component to reproduce

import React, { useEffect } from 'react';
import { Alert } from 'react-native';
import Mapbox from '@rnmapbox/maps';
import sheet from '../../styles/sheet';
import { ExampleWithMetadata } from '../common/ExampleMetadata'; // exclude-from-doc

const ShowMap = () => {

  useEffect(() => {
    Mapbox.locationManager.start();

    return (): void => {
      Mapbox.locationManager.stop();
    };
  }, []);

  const onUserMarkerPress = (): void => {
    Alert.alert('You pressed on the user location annotation');
  };

  return (
    <>
      <Mapbox.MapView
        styleURL='mapbox://styles/mapbox/satellite-v9'
        style={sheet.matchParent}
        testID={'show-map'}
        gestureSettings={{rotateEnabled: false, simultaneousRotateAndPinchZoomEnabled: false, rotateDecelerationEnabled: false}}
      >
        <Mapbox.Camera followZoomLevel={12} followUserLocation />

        <Mapbox.UserLocation onPress={onUserMarkerPress} />
      </Mapbox.MapView>
    </>
  );
};

export default ShowMap;

Observed behavior and steps to reproduce

https://github.com/user-attachments/assets/4fc92d0b-c83b-4f23-bdf3-608729d6a1e2

Expected behavior

When rotateEnabled in gestureSettings is set to false, the user can't rotate the map.

Notes / preliminary analysis

No response

Additional links and references

No response

github-actions[bot] commented 3 weeks ago

Lint failed :sob:

Please fix the errors in your code example - More info.:


error: Parsing error: Unexpected token ) at example.jsx:13:13:
  11 |     Mapbox.locationManager.start();
  12 | 
> 13 |     return (): void => {
     |             ^
  14 |       Mapbox.locationManager.stop();
  15 |     };
  16 |   }, []);

1 error found.```