mirror of
https://github.com/status-im/re-natal.git
synced 2025-02-09 11:14:19 +00:00
use natal-shell in om next template
This commit is contained in:
parent
3bb110e743
commit
5d91bc5dae
@ -2,21 +2,14 @@
|
|||||||
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
||||||
|
|
||||||
(ns $PROJECT_NAME_HYPHENATED$.core
|
(ns $PROJECT_NAME_HYPHENATED$.core
|
||||||
(:require [om.next :as om :refer-macros [defui]]))
|
(:require [om.next :as om :refer-macros [defui]])
|
||||||
|
(:require-macros [natal-shell.components :refer [view text image touchable-highlight]]
|
||||||
|
[natal-shell.alert-ios :refer [alert]]))
|
||||||
|
|
||||||
;; Reset js/React back as the form above loads in a different React
|
;; Reset js/React back as the form above loads in a different React
|
||||||
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
||||||
|
|
||||||
|
|
||||||
;; Set up some methods to help create React Native elements
|
|
||||||
(defn view [opts & children]
|
|
||||||
(apply js/React.createElement js/React.View (clj->js opts) children))
|
|
||||||
|
|
||||||
(defn text [opts & children]
|
|
||||||
(apply js/React.createElement js/React.Text (clj->js opts) children))
|
|
||||||
|
|
||||||
|
|
||||||
;; Set up our Om UI
|
|
||||||
(defonce app-state (atom {:app/msg "Welcome to $PROJECT_NAME$"}))
|
(defonce app-state (atom {:app/msg "Welcome to $PROJECT_NAME$"}))
|
||||||
|
|
||||||
(defui WidgetComponent
|
(defui WidgetComponent
|
||||||
@ -25,9 +18,19 @@
|
|||||||
'[:app/msg])
|
'[:app/msg])
|
||||||
Object
|
Object
|
||||||
(render [this]
|
(render [this]
|
||||||
(let [{:keys [app/msg]} (om/props this)]
|
(let [{:keys [app/msg]} (om/props this)]
|
||||||
(view {:style {:flexDirection "column" :margin 40}}
|
(view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
|
||||||
(text {:style {:fontSize 50 :fontWeight "100"}} msg)))))
|
(text
|
||||||
|
{:style {:fontSize 50 :fontWeight "100" :marginBottom 20 :textAlign "center"}}
|
||||||
|
msg)
|
||||||
|
|
||||||
|
(image {:source {:uri "https://raw.githubusercontent.com/cljsinfo/logo.cljs/master/cljs.png"}
|
||||||
|
:style {:width 80 :height 80 :marginBottom 30}})
|
||||||
|
|
||||||
|
(touchable-highlight
|
||||||
|
{:style {:backgroundColor "#999" :padding 10 :borderRadius 5}
|
||||||
|
:onPress #(alert "HELLO!")}
|
||||||
|
(text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"))))))
|
||||||
|
|
||||||
;; om.next parser
|
;; om.next parser
|
||||||
(defmulti read om/dispatch)
|
(defmulti read om/dispatch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user