2016-02-25 20:05:46 +00:00
|
|
|
(ns $PROJECT_NAME_HYPHENATED$.$PLATFORM$.core
|
|
|
|
(:require [reagent.core :as r :refer [atom]]
|
|
|
|
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
2016-08-07 12:01:34 +00:00
|
|
|
[$PROJECT_NAME_HYPHENATED$.events]
|
2016-02-25 20:05:46 +00:00
|
|
|
[$PROJECT_NAME_HYPHENATED$.subs]))
|
|
|
|
|
2016-05-05 16:35:20 +00:00
|
|
|
(def ReactNative (js/require "react-native"))
|
2016-02-25 20:05:46 +00:00
|
|
|
|
2016-05-05 16:35:20 +00:00
|
|
|
(def app-registry (.-AppRegistry ReactNative))
|
|
|
|
(def text (r/adapt-react-class (.-Text ReactNative)))
|
|
|
|
(def view (r/adapt-react-class (.-View ReactNative)))
|
|
|
|
(def image (r/adapt-react-class (.-Image ReactNative)))
|
|
|
|
(def touchable-highlight (r/adapt-react-class (.-TouchableHighlight ReactNative)))
|
2016-02-25 20:05:46 +00:00
|
|
|
|
|
|
|
(def logo-img (js/require "./images/cljs.png"))
|
|
|
|
|
|
|
|
(defn alert [title]
|
2016-05-05 16:35:20 +00:00
|
|
|
(.alert (.-Alert ReactNative) title))
|
2016-02-25 20:05:46 +00:00
|
|
|
|
|
|
|
(defn app-root []
|
|
|
|
(let [greeting (subscribe [:get-greeting])]
|
|
|
|
(fn []
|
|
|
|
[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 :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 init []
|
|
|
|
(dispatch-sync [:initialize-db])
|
|
|
|
(.registerComponent app-registry "$PROJECT_NAME$" #(r/reactify-component app-root)))
|