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

[Bug]: Crash when changing Annotations source state in iOS #3419

Open
g-sharat opened this issue Mar 11, 2024 · 0 comments
Open

[Bug]: Crash when changing Annotations source state in iOS #3419

g-sharat opened this issue Mar 11, 2024 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@g-sharat
Copy link

g-sharat commented Mar 11, 2024

Mapbox Implementation

Mapbox

Mapbox Version

default

React Native Version

0.73.4

Platform

iOS

@rnmapbox/maps version

10.1.19

Standalone component to reproduce

/* eslint-disable react/prop-types */
import {View, Text, StyleSheet, Button} from 'react-native';
import React, {useEffect, useRef, useState} from 'react';

import Mapbox, {Callout, Camera} from '@rnmapbox/maps';


export default function MapsPage() {
  var mapRef = useRef();

  const markers1 = [
    {
      cord: [2.0, -2.9999],
      isFav: true,
    },
    {
      cord: [5.044, -2.9999],
      isFav: true,
    },
    {
      cord: [9.044, -3.999],
      isFav: false,
    },
  ];

  const markers2 = [
    {
      cord: [3.0, -5.9999],
      isFav: true,
    },
    {
      cord: [4.044, -9.9999],
      isFav: true,
    },
    {
      cord: [9.044, -11.999],
      isFav: false,
    },
  ];
  var [markers, setmarkers] = useState(markers1);

  useEffect(() => {
    setmarkers(markers1);
  }, []);

  const MyTxt = ({item}) => {
    return (
      <View style={{height: 20, backgroundColor: 'green'}}>
        <Text>Jam</Text>
      </View>
    );
  };

  return (
    <View style={styles.page}>
      <View style={styles.container}>
        <Mapbox.MapView style={styles.map}>
          <Mapbox.Camera
            defaultSettings={{
              centerCoordinate: [2.0, -2.9999],
              zoomLevel: 4,
            }}
          />

          {markers.map(item => {
            return (
              <Mapbox.PointAnnotation
                key={`long${item.cord[0]}`}
                id={`${item.cord[0] + item.cord[1]}`}
                coordinate={[item.cord[0], item.cord[1]]}>
                <MyTxt item={item} />
                <Callout title="Place name" />
              </Mapbox.PointAnnotation>
            );
          })}
        </Mapbox.MapView>
        <Button title="Change markers" onPress={() => setmarkers(markers2)} />
      </View>
    </View>
  );
}
const styles = StyleSheet.create({
  page: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  container: {
    height: '100%',
    width: '100%',
  },
  map: {
    flex: 1,
  },
});

Simulator Screenshot - iPhone 15 Pro Max - 2024-03-11 at 10 43 07
Simulator Screenshot - iPhone 15 Pro Max - 2024-03-11 at 10 42 49

Observed behavior and steps to reproduce

Issue seems to be similar to #3412

Expected behavior

No response

Notes / preliminary analysis

No response

Additional links and references

No response

@g-sharat g-sharat added the bug 🪲 Something isn't working label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant