From a125852aacf41f9f2e1c5e275db9224984ed2689 Mon Sep 17 00:00:00 2001 From: Artur Girenko Date: Mon, 21 Dec 2015 19:49:03 +0100 Subject: [PATCH] add alert, it is now supported in both iOS and Android --- resources/cljs/core.cljs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/cljs/core.cljs b/resources/cljs/core.cljs index ab4c464..92c3b2a 100644 --- a/resources/cljs/core.cljs +++ b/resources/cljs/core.cljs @@ -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))