Skip to content

ERROR Invariant Violation: View config getter callback for component AIRMapMarker must be a function (received undefined). #5

@guilhermedunguel0

Description

@guilhermedunguel0

Hello! I was trying to add Polygon Editor to my React Native APP and i'm facing an issue. Everytime i add an polygon to map and tap at the polygon my App crashes and the console shows this error:

ERROR Invariant Violation: View config getter callback for component AIRMapMarker must be a function (received undefined).

My code are just like this:

import { Container, MapWrapper } from "@/styles/pages/map.styled";
import { StatusBar } from "expo-status-bar";
import { Polygon } from "react-native-maps";
import {
  PolygonEditor,
  getRandomPolygonColors,
  PolygonEditorRef,
  MapPolygonExtendedProps,
} from "@siposdani87/expo-maps-polygon-editor";
import { useRef } from "react";

const [strokeColor, fillColor] = getRandomPolygonColors();
const polygons: MapPolygonExtendedProps[] = [
  {
    key: "key_0",
    coordinates: [
      { latitude: -15.630917, longitude: -46.281428 },
      { latitude: -16.630917, longitude: -47.281428 },
      { latitude: -14.630917, longitude: -47.281428 },
      { latitude: -14.630917, longitude: -44.281428 },
    ],
    strokeWidth: 2,
    strokeColor,
    fillColor,
  },
];

export default function MapPage() {
  const polygonEditorRef = useRef<PolygonEditorRef>(null);
  return (
    <>
      <StatusBar style="dark" backgroundColor="#f8fafc" />
      <Container>
        <MapWrapper>
          <PolygonEditor ref={polygonEditorRef} polygons={polygons} />
        </MapWrapper>
      </Container>
    </>
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions