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

fix(ios,camera): apply camera changes when no center or bounds specified #3415

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

mfazekas
Copy link
Contributor

@mfazekas mfazekas commented Mar 9, 2024

Fixes: #3413

Issue was caused by change: #3354

Example to repro was:

import React, { useRef, useEffect } from 'react';
import { Button } from 'react-native';
import { MapView, ShapeSource, LineLayer, Camera } from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

const BugReportExample = () => {
  const cameraRef = useRef();
  useEffect(() => {
    setTimeout(() => cameraRef.current?.setCamera({ heading: 90 }), 2000);
  }, []);
  return (
    <>
      <Button
        onPress={() => cameraRef.current?.setCamera({ heading: 90 })}
        title="Set heading to 90"
      />
      <MapView style={{ flex: 1 }}>
        <Camera
          defaultSettings={{
            centerCoordinate: [-74.00597, 40.71427],
            heading: 30,
            zoomLevel: 14,
          }}
          ref={cameraRef}
        />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    </>
  );
};

export default BugReportExample;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: iOS: Can only change pitch or heading via setCamera when centerCoordinate is specified
1 participant