Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mfazekas
Copy link
Contributor

@mfazekas mfazekas commented Oct 14, 2025

Description

Fixes: #4034

TODO

  • Fix android select/deselet

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Screenshot OR Video

Component to reproduce the issue you're fixing

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

export default function BugReportExample() {
  const [selected, setSelected] = React.useState(false);
  React.useEffect(() => {
    console.log('Selected:', selected);
  }, [selected]);

  return (
    <MapView style={{ flex: 1 }} onPress={() => setSelected(false)}>
      <Camera
        defaultSettings={{
          centerCoordinate: [-74.00597, 40.71427],
          zoomLevel: 14,
        }}
      />
      <PointAnnotation
        id="foo"
        coordinate={[-74.00597, 40.71427]}
        selected={selected}
        onSelected={() => {
          console.log('onSelected');
          setSelected(true);
        }}
        onDeselected={() => {
          console.log('onDeselected');
          setSelected(false);
        }}
      >
        <View style={{ height: 40, width: 40, backgroundColor: 'red' }} />
      </PointAnnotation>
    </MapView>
  );
}

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]: PointAnnotation selected not allowing controlled values

2 participants