require react-native in namespace declaration

This commit is contained in:
Artur Girenko 2017-09-27 22:46:23 +02:00
parent 6951f8c373
commit ced5d721ca
4 changed files with 18 additions and 11 deletions

View File

@ -6,4 +6,8 @@
:static-fns true :static-fns true
:optimize-constants true :optimize-constants true
:optimizations :advanced :optimizations :advanced
:target :nodejs
:npm-deps {:react-native "0.48.4"
:react "16.0.0-alpha.12"
:create-react-class "15.6.0"}
:closure-defines {"goog.DEBUG" false}}} :closure-defines {"goog.DEBUG" false}}}

View File

@ -2,20 +2,19 @@
(:require [reagent.core :as r :refer [atom]] (:require [reagent.core :as r :refer [atom]]
[re-frame.core :refer [subscribe dispatch dispatch-sync]] [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[$PROJECT_NAME_HYPHENATED$.events] [$PROJECT_NAME_HYPHENATED$.events]
[$PROJECT_NAME_HYPHENATED$.subs])) [$PROJECT_NAME_HYPHENATED$.subs]
[react-native :as rn]))
(def ReactNative (js/require "react-native")) (def app-registry rn/AppRegistry)
(def text (r/adapt-react-class rn/Text))
(def app-registry (.-AppRegistry ReactNative)) (def view (r/adapt-react-class rn/View))
(def text (r/adapt-react-class (.-Text ReactNative))) (def image (r/adapt-react-class rn/Image))
(def view (r/adapt-react-class (.-View ReactNative))) (def touchable-highlight (r/adapt-react-class rn/TouchableHighlight))
(def image (r/adapt-react-class (.-Image ReactNative)))
(def touchable-highlight (r/adapt-react-class (.-TouchableHighlight ReactNative)))
(def logo-img (js/require "./images/cljs.png")) (def logo-img (js/require "./images/cljs.png"))
(defn alert [title] (defn alert [title]
(.alert (.-Alert ReactNative) title)) (.alert rn/Alert title))
(defn app-root [] (defn app-root []
(let [greeting (subscribe [:get-greeting])] (let [greeting (subscribe [:get-greeting])]

View File

@ -5,6 +5,8 @@
:main "env.$PLATFORM$.main" :main "env.$PLATFORM$.main"
:output-dir "target/$PLATFORM$" :output-dir "target/$PLATFORM$"
:optimizations :none :optimizations :none
:npm-deps {:react "16.0.0-alpha.12" :target :nodejs
:npm-deps {:react-native "0.48.4"
:react "16.0.0-alpha.12"
:create-react-class "15.6.0"} :create-react-class "15.6.0"}
:install-deps true}} :install-deps true}}

View File

@ -6,7 +6,9 @@
:static-fns true :static-fns true
:optimize-constants true :optimize-constants true
:optimizations :simple :optimizations :simple
:npm-deps {:react "16.0.0-alpha.12" :target :nodejs
:npm-deps {:react-native "0.48.4"
:react "16.0.0-alpha.12"
:create-react-class "15.6.0"} :create-react-class "15.6.0"}
:install-deps true :install-deps true
:closure-defines {"goog.DEBUG" false}}} :closure-defines {"goog.DEBUG" false}}}