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 does not render Image in React Native 0.76.1 #3695

Open
alex-mironov opened this issue Nov 15, 2024 · 0 comments
Open

[Bug]: MarkerView does not render Image in React Native 0.76.1 #3695

alex-mironov opened this issue Nov 15, 2024 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@alex-mironov
Copy link

alex-mironov commented Nov 15, 2024

Mapbox Implementation

Mapbox

Mapbox Version

default

React Native Version

0.76.1

Platform

iOS

@rnmapbox/maps version

10.1.33

Standalone component to reproduce

import React from "react";
import { StyleSheet, View, Image, SafeAreaView } from "react-native";
import Mapbox from "@rnmapbox/maps";

Mapbox.setAccessToken(
  "pk..",
);

const MapBox = () => {
  return (
    <View style={{ flex: 1 }}>
      <SafeAreaView>
        <View style={{ borderWidth: 1 }}>
          <Image
            style={{
              width: 24,
              height: 24,
              backgroundColor: "rgb(251, 113, 133)",
            }}
            source={{
              uri: "https://reactnative.dev/img/tiny_logo.png",
            }}
          />
        </View>
      </SafeAreaView>

      <Mapbox.MapView style={styles.map}>
        <Mapbox.Camera
          zoomLevel={12}
          centerCoordinate={[-74.00597, 40.71427]}
          animationMode="moveTo"
          animationDuration={0}
        />
        <Mapbox.PointAnnotation
          id="temp"
          coordinate={[-74.00597, 40.71427]}
          onSelected={() => {
            // TODO:
          }}
        >
          <Mapbox.MarkerView coordinate={[-74.00597, 40.71427]}>
            <View style={{ backgroundColor: "rgb(251, 113, 133)" }}>
              <Image
                style={{ width: 24, height: 24 }}
                source={{
                  uri: "https://reactnative.dev/img/tiny_logo.png",
                }}
              />
            </View>
          </Mapbox.MarkerView>

          <Mapbox.Callout
            containerStyle={styles.calloutContainer}
            style={styles.callout}
            textStyle={styles.calloutText}
            tipStyle={styles.calloutTip}
            contentStyle={styles.contentStyle}
            title={"Custom Pin"}
          />
        </Mapbox.PointAnnotation>
      </Mapbox.MapView>
    </View>
  );
};

export default MapBox;

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    flex: 1,
  },
  calloutContainer: {},
  callout: {},
  contentStyle: {
    borderRadius: 8,
  },
  calloutText: {
    color: '#000000',
    letterSpacing: 0.25,
  },
  calloutTip: {
    borderTopWidth: 10,
    borderLeftWidth: 8,
    borderRightWidth: 8,
    borderTopColor: '#ffffff',
    borderLeftColor: "transparent",
    borderRightColor: "transparent",
  },
});

Observed behavior and steps to reproduce

MarkerView is not rendering custom image in React Native v.76.0.
image

Expected behavior

When using custom image it should be rendered correctly in MarkerView

Notes / preliminary analysis

No response

Additional links and references

No response

@alex-mironov alex-mironov added the bug 🪲 Something isn't working label Nov 15, 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