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,fabric): do not apply camera stops on render unless stops wer… #3349

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

mfazekas
Copy link
Contributor

…e changed

Used the following component to reproduce the issue:

  • Press fly to
  • Use pan gesture to change camera
  • Press Re-Render this will cause a re-render a camera change
import React, { useRef } from 'react';
import { Button, Text } from 'react-native';
import { MapView, Camera } from '@rnmapbox/maps';

function App() {
  let camerRef = useRef(null);
  let [counter, setCounter] = React.useState(0);
  return (
    <>
      <Button
        title="Fly to"
        onPress={() => {
          camerRef.current.flyTo([-74.10597, 41.71427]);
        }}
      />
      <Button
        title="Re-render"
        onPress={() => {
          setCounter(counter + 1);
        }}
      />
      <Text>Counter: {counter}</Text>
      <MapView style={{ flex: 1 }}>
        <Camera
          defaultSettings={{
            centerCoordinate: [-74.00597, 40.71427],
            zoomLevel: 15,
          }}
          ref={camerRef}
        />
      </MapView>
    </>
  );
}

export default App;

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.

1 participant