-
-
Save gphilipp/5c50c3208d95711eccd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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