I am trying to create a simple Map app using Expo and Clojurescript, but when I try to render the map I get the following error:
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
This is what the code looks like:
(ns map-test.core
(:require [reagent.core :as r :refer [atom]]
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
[oops.core :refer [ocall]]
[map-test.handlers]
[map-test.subs]))
(def ReactNative (js/require "react-native"))
(def expo (js/require "expo"))
(def view (r/adapt-react-class (.-View ReactNative)))
(def text (r/adapt-react-class (.-Text ReactNative)))
(def MapView (js/require "react-native-maps"))
(def map-view (r/adapt-react-class MapView))
(defn app-root []
[view {:style {:flex 1}}
[map-view]])
(defn init []
(dispatch-sync [:initialize-db])
(ocall expo "registerRootComponent" (r/reactify-component app-root)))
This is my package.json
:
{
"name": "map-test",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"main": "main.js",
"dependencies": {
"expo": "^34.0.3",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"create-react-class": "15.6.3",
"react-native-maps": "~0.24.0"
}
}
I tried to follow the answer shown in here: Using React Native MapView in ClojureScript Reagent but it doesn't seem to work.
All help appreciated!