I am trying to use MapView
from https://github.com/airbnb/react-native-maps using Reagent. It works fine but how could I get local state for MapView
when onRegionChange
event is fired? Trying to use current/component but it is always nil
.
(def Expo (js/require "expo"))
(def map-view (r/adapt-react-class (.-MapView Expo)))
(defn my-map []
(r/create-class
{:component-did-mount (fn [this]
(println "component mount "))
:reagent-render (fn []
(let [this (r/current-component)]
[map-view {:style {:flex 1}
:initialRegion {:latitude 37.78825
:longitude -122.4324
:latitudeDelta 0.0922
:longitudeDelta 0.0421}
:onRegionChange (fn []
;; Would like to see state here.
(println (.. this -state)) )}]))}))