2015-11-29 21:10:01 +00:00
|
|
|
(ns ^:figwheel-load $PROJECT_NAME_HYPHENATED$.$PLATFORM$.core
|
2015-11-28 15:20:39 +00:00
|
|
|
(:require-macros [env.require-img :refer [require-img]])
|
2015-11-20 19:22:02 +00:00
|
|
|
(:require [reagent.core :as r :refer [atom]]
|
|
|
|
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
2015-11-20 21:43:47 +00:00
|
|
|
[$PROJECT_NAME_HYPHENATED$.handlers]
|
|
|
|
[$PROJECT_NAME_HYPHENATED$.subs]))
|
2015-11-20 19:22:02 +00:00
|
|
|
|
2015-11-20 21:43:47 +00:00
|
|
|
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
2015-11-20 19:22:02 +00:00
|
|
|
|
2015-11-24 21:44:57 +00:00
|
|
|
(def app-registry (.-AppRegistry js/React))
|
2015-11-20 19:22:02 +00:00
|
|
|
(def text (r/adapt-react-class (.-Text js/React)))
|
|
|
|
(def view (r/adapt-react-class (.-View js/React)))
|
|
|
|
(def image (r/adapt-react-class (.-Image js/React)))
|
|
|
|
(def touchable-highlight (r/adapt-react-class (.-TouchableHighlight js/React)))
|
|
|
|
|
2015-11-28 15:20:39 +00:00
|
|
|
(def logo-img (require-img "./images/cljs.png"))
|
|
|
|
|
2015-11-20 19:22:02 +00:00
|
|
|
(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]
|
2015-11-28 15:20:39 +00:00
|
|
|
[image {:source logo-img
|
2015-11-20 19:22:02 +00:00
|
|
|
: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"]]])))
|
|
|
|
|
2015-11-27 22:57:14 +00:00
|
|
|
(defn mount-root []
|
|
|
|
(r/render [widget] 1))
|
|
|
|
|
|
|
|
(defn ^:export init []
|
|
|
|
(dispatch-sync [:initialize-db])
|
|
|
|
(.registerRunnable app-registry "$PROJECT_NAME$" #(mount-root)))
|