Skip to content

Markerview anchor attribute not working #1158

@AymericIppon

Description

@AymericIppon

Describe and reproduce the Bug

Seems like anchor attribute is not taken into account and default value is kept.
The workaround I found is to use a state to update anchor value from a dummy value to the one I want after onDidFinishRenderingMapFully.

If I set the anchor value I want but display the MarkerView only after onDidFinishRenderingMapFully, the anchor is still centered.

I am using :

  • "@maplibre/maplibre-react-native": "10.4.2"
  • "react-native": "0.81.5"
  • "expo": "54.0.25"

My fix :

export function BugReport() {
const [mapReady, setMapReady] = useState(false);

  return (
    <MapView style={{ flex: 1 }} onDidFinishRenderingMapFully={() => setMapReady(true)}>
      {Array.from(stops.entries()).map(([letter, coordinates]) => (
          <MarkerView
            key={`marker-${coordinates[0]}-${coordinates[1]}`}
            coordinate={coordinates}
            anchor={mapReady ? { x: 0.5, y: 1 } : undefined}
          >
            <PinIcon letter={letter} />
          </MarkerView>
        ))}
    </MapView>
  );
}

@maplibre/maplibre-react-native Version

10.4.2

Which platforms does this occur on?

No response

Which frameworks does this occur on?

Expo

Which architectures does this occur on?

No response

Environment

expo-env-info 2.0.8 environment info:
    System:
      OS: macOS 15.3
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 23.1.0 - /opt/homebrew/bin/node
      npm: 10.9.0 - /opt/homebrew/bin/npm
    Managers:
      CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 24.5, iOS 18.5, macOS 15.5, tvOS 18.5, visionOS 2.5, watchOS 11.5
      Android SDK:
        API Levels: 28, 29, 30, 31, 33, 33, 34, 34, 35, 36
        Build Tools: 30.0.3, 33.0.1, 34.0.0, 35.0.0, 36.0.0
        System Images: android-33 | Google APIs ARM 64 v8a
    IDEs:
      Android Studio: 2024.2 AI-242.23726.103.2422.12816248
      Xcode: 16.4/16F6 - /usr/bin/xcodebuild
    npmPackages:
      expo: 54.0.25 => 54.0.25 
      expo-router: 6.0.15 => 6.0.15 
      react: 19.1.0 => 19.1.0 
      react-dom: 19.1.0 => 19.1.0 
      react-native: 0.81.5 => 0.81.5 
      react-native-web: 0.21.0 => 0.21.0 
    Expo Workflow: bare

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions