rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.28k stars 848 forks source link

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

Open alex-mironov opened 1 week ago

alex-mironov commented 1 week ago

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