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(android): initial centerCoordinate should apply #3372

Merged
merged 1 commit into from Feb 13, 2024

Conversation

mfazekas
Copy link
Contributor

@mfazekas mfazekas commented Feb 13, 2024

Fixes: #3371

The issue was caused by #3349, which prevented camera settings to apply on all re-render. Unfortunately it's also prevented initial camera settings to apply.

Uses this component to repro/test:

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

class BugReportExample extends React.Component {
  state = {
    center: [-74.00597, 40.71427],
    count: 0,
  };

  render() {
    return (
      <>
        <Button
          title="Change location"
          onPress={() => this.setState({ center: [-74.01597, 40.71427] })}
        />
        <Button
          title={`Counter: ${this.state.count}`}
          onPress={() => this.setState({ count: this.state.count + 1 })}
        />
        <MapView style={{ flex: 1 }}>
          <Camera centerCoordinate={this.state.center} zoomLevel={14} />
        </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]: Broken Camera centerCoordinate
1 participant