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

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

Open
GuilhermeDunguel opened this issue Mar 1, 2024 · 0 comments

Comments

@GuilhermeDunguel
Copy link

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>
    </>
  );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant