add alert, it is now supported in both iOS and Android

This commit is contained in:
Artur Girenko 2015-12-21 19:49:03 +01:00
parent 2af7df164e
commit a125852aac
1 changed files with 9 additions and 5 deletions

View File

@ -15,15 +15,19 @@
(def logo-img (require-img "./images/cljs.png"))
(defn alert [title]
(.alert (.-Alert js/React) title))
(defn widget []
(let [greeting (subscribe [:get-greeting])]
(fn []
[view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
[text {:style {:fontSize 30 :fontWeight "100" :marginBottom 20 :textAlign "center"}} @greeting]
[view {:style {:flex-direction "column" :margin 40 :align-items "center"}}
[text {:style {:font-size 30 :font-weight "100" :margin-bottom 20 :text-align "center"}} @greeting]
[image {:source logo-img
:style {:width 80 :height 80 :marginBottom 30}}]
[touchable-highlight {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}}
[text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"]]])))
:style {:width 80 :height 80 :margin-bottom 30}}]
[touchable-highlight {:style {:background-color "#999" :padding 10 :border-radius 5}
:on-press #(alert "HELLO!")}
[text {:style {:color "white" :text-align "center" :font-weight "bold"}} "press me"]]])))
(defn mount-root []
(r/render [widget] 1))