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]: MarkerView Visibility Issue on Android (V11) #3239

Closed
ysainson opened this issue Dec 5, 2023 · 0 comments · Fixed by #3242
Closed

[Bug]: MarkerView Visibility Issue on Android (V11) #3239

ysainson opened this issue Dec 5, 2023 · 0 comments · Fixed by #3242
Labels
bug 🪲 Something isn't working

Comments

@ysainson
Copy link

ysainson commented Dec 5, 2023

Mapbox Implementation

Mapbox

Mapbox Version

11.0.0

Platform

Android

@rnmapbox/maps version

10.1.0-rc.1

Standalone component to reproduce

import React, { useState } from "react";

import { Button, Platform, View } from "react-native";
import Mapbox from "@rnmapbox/maps";

const MapView = () => {
  const [isVisible, setIsVisible] = useState(true);

  console.log(isVisible);

  // render
  return (
    <>
      <Mapbox.MapView
        style={{ flex: 1 }}
        styleURL="mapbox://styles/mapbox/standard-beta"
      >
        <Mapbox.StyleImport
          id="basemap"
          existing
          config={{
            lightPreset: "dusk",
            // @ts-ignore
            showRoadLabels: false,
            // @ts-ignore
            showPlaceLabels: false,
            // @ts-ignore
            showTransitLabels: false,
            // @ts-ignore
            showPointOfInterestLabels: false,
          }}
        />
        <Mapbox.Camera
          centerCoordinate={[-122.008921, 37.334508]}
          pitch={0}
          zoomLevel={14}
        />

        {isVisible ? (
          <Mapbox.MarkerView
            // allowOverlap => Visible at first if true
            coordinate={[-122.008921, 37.334508]}
          >
            <View style={{ width: 50, height: 50, backgroundColor: "red" }} />
          </Mapbox.MarkerView>
        ) : null}
      </Mapbox.MapView>
      <View style={{ height: 100, justifyContent: "center" }}>
        <Button
          title="Toggle visibility"
          onPress={() => setIsVisible(!isVisible)}
        />
      </View>
    </>
  );
};

export default MapView;

Observed behavior and steps to reproduce

Issue Description

I'm encountering an issue with the visibility of Mapbox.MarkerView on Android. The marker view doesn't appear initially. It only appears after toggling the visibility three times using a button that changes the isVisible state. Furthermore, if the allowOverlap prop is passed to Mapbox.MarkerView, it is visible at first but disappears and never reappears upon triggering the visibility toggle button.

Steps to Reproduce

  1. Open the map view containing the Mapbox.MarkerView.
    Initially, the marker is not visible.
  2. Click the "Toggle visibility" button.
    Surprisingly, the marker appears only when the isVisible state is set to false after three toggles, which is contrary to the expected behavior. It should appear when isVisible is true.

Additionally, I receive the following error in my full app, although I couldn't reproduce it in this sample:

Trying to add view annotation that was already added before! Please consider deleting annotation view (com.rnmapbox.components.annotation.RNMBXMarkerViewContent(e04...) beforehand.

Observed behavior

  • The marker view does not appear on the initial render.
  • Requires three button presses to display the marker when isVisible is set to false.
  • Inconsistent behavior when using the allowOverlap prop.
  • Error message regarding adding already added view annotations in the full app.

Expected behavior

  • The marker should be visible when the component mounts if isVisible is true.
  • Toggling the visibility with the button should show/hide the marker view on each press.
  • No errors about adding view annotations that were already added.

Notes / preliminary analysis

No response

Additional links and references

No response

@ysainson ysainson added the bug 🪲 Something isn't working label Dec 5, 2023
@github-actions github-actions bot closed this as completed Dec 5, 2023
@github-actions github-actions bot reopened this Dec 5, 2023
@ysainson ysainson changed the title [Bug]: MarkerView Visibility Issue on Android V11 [Bug]: MarkerView Visibility Issue on Android (V11) Dec 5, 2023
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

Successfully merging a pull request may close this issue.

1 participant