Skip to content

Instantly share code, notes, and snippets.

@gphilipp
Last active December 3, 2015 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gphilipp/5c50c3208d95711eccd4 to your computer and use it in GitHub Desktop.
Save gphilipp/5c50c3208d95711eccd4 to your computer and use it in GitHub Desktop.
(defui HomeComponent
static om/IQuery
(query [this]
'[{:person [:first-name :last-name]} :passProps :route :accounts])
Object
(render [this]
(try
(let [passProps (:passProps (js->clj (.-route (.-props this)) :keywordize-keys true))
props (om/props this)
{:keys [app/msg person accounts]} props
_ (println "accounts:" accounts)
_ (println "props in HomeComponent" props)
_ (println "passprops in HomeComponent" passProps)]
(view {:style {:flex 1
:flexDirection "column"
:margin 10
:justifyContent "center"
}}
(view {:style {:marginTop 30
:marginBottom 30}}
(text {:style {:color "Black" :textAlign "center" :fontWeight "bold"}}
"Clojure People"))
(text {:style {:textAlign "center" :fontSize 20 :fontWeight "200"
}}
(str (:first-name person) " " (:last-name person)))
)
(catch :default e
(view {:style {:backgroundColor "#cc0814" :flex 1 :padding 20 :paddingTop 40}}
(text
{:style {:fontWeight "normal" :color "white" :fontSize 24 :marginBottom 10}}
"ERROR")
(text
{:style {:color "white" :fontFamily "Menlo-Regular" :fontSize 16 :lineHeight 24}}
(.-message e))
(text
{:style {:color "white" :marginTop 20 :fontSize 16 :fontWeight "bold"}}
"Check REPL log for details."))))))
(defui WidgetComponent
static om/IQuery
(query
[this]
'[:accounts :person])
Object
(render
[this]
(let [props (om/props this)
_ (println "props in WidgetComponent:" props)]
(navigator-ios {:style {:flex 1}
:initialRoute {:component HomeComponent
:passProps (clj->js props)
}}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment