mirror of
https://github.com/status-im/re-natal.git
synced 2025-02-24 02:08:08 +00:00
merge fix
This commit is contained in:
commit
8d44114e4c
@ -2,7 +2,7 @@
|
|||||||
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
||||||
|
|
||||||
(ns $PROJECT_NAME_HYPHENATED$.core
|
(ns $PROJECT_NAME_HYPHENATED$.core
|
||||||
(:require [om.core :as om]))
|
(:require [om.next :as om :refer-macros [defui]]))
|
||||||
|
|
||||||
;; Reset js/React back as the form above loads in an different React
|
;; Reset js/React back as the form above loads in an different React
|
||||||
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
||||||
@ -17,16 +17,36 @@
|
|||||||
|
|
||||||
|
|
||||||
;; Set up our Om UI
|
;; Set up our Om UI
|
||||||
(defonce app-state (atom {:text "Welcome to $PROJECT_NAME$"}))
|
(defonce app-state (atom {:app/msg "Welcome to $PROJECT_NAME$"}))
|
||||||
|
|
||||||
(defn widget [data owner]
|
(defui WidgetComponent
|
||||||
(reify
|
static om/IQuery
|
||||||
om/IRender
|
(query [this]
|
||||||
(render [this]
|
'[:app/msg])
|
||||||
(view {:style {:flexDirection "column" :margin 40}}
|
Object
|
||||||
(text nil (:text data))))))
|
(render [this]
|
||||||
|
(let [{:keys [app/msg]} (om/props this)]
|
||||||
|
(view {:style {:flexDirection "column" :margin 40}}
|
||||||
|
(text nil msg)))))
|
||||||
|
|
||||||
(om/root widget app-state {:target 1})
|
;; om.next parser
|
||||||
|
(defmulti read om/dispatch)
|
||||||
|
(defmethod read :default
|
||||||
|
[{:keys [state]} k _]
|
||||||
|
(let [st @state]
|
||||||
|
(find st k)
|
||||||
|
(if-let [[_ v] (find st k)]
|
||||||
|
{:value v}
|
||||||
|
{:value :not-found})))
|
||||||
|
|
||||||
|
(def reconciler
|
||||||
|
(om/reconciler
|
||||||
|
{:state app-state
|
||||||
|
:parser (om/parser {:read read})
|
||||||
|
:root-render #(.render js/React %1 %2)
|
||||||
|
:root-unmount #(.unmountComponentAtNode js/React %)}))
|
||||||
|
|
||||||
|
(om/add-root! reconciler WidgetComponent 1)
|
||||||
|
|
||||||
(defn ^:export init []
|
(defn ^:export init []
|
||||||
((fn render []
|
((fn render []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user