Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/devcards/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
;; this channel is only used for card registration notifications
(defonce devcard-event-chan (chan))

(def react-element-type-symbol
"Make a react Symbol the same way as React 0.14"
(or (and (exists? js/Symbol)
(fn? js/Symbol)
(aget js/Symbol "for")
((aget js/Symbol "for") "react.element"))
0xeac7))

;; its possible to record the meta-data for the loaded ns's being
;; shipped by figwheel, by ataching a before load listener and storing
;; the meta data, might be better to have figwheel do that.
Expand Down Expand Up @@ -358,7 +366,9 @@
:value x})))

(defn react-element? [main-obj]
(aget main-obj "_isReactElement"))
(or (aget main-obj "_isReactElement") ;; react 0.13
(= react-element-type-symbol ;; react 0.14
(aget main-obj "$$typeof"))))

(defn validate-card-options [opts]
(if (map? opts)
Expand Down
6 changes: 4 additions & 2 deletions src/devcards/system.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@
(defn start-ui-with-renderer [channel renderer]
(defonce devcards-ui-setup
(do
(js/React.initializeTouchEvents true)
(when (exists? js/React.initializeTouchEvents)
(js/React.initializeTouchEvents true))
(go
(<! (load-data-from-channel! channel))

Expand All @@ -434,7 +435,8 @@
(defn start-ui [channel]
(defonce devcards-ui-setup
(do
(js/React.initializeTouchEvents true)
(when (exists? js/React.initializeTouchEvents)
(js/React.initializeTouchEvents true))
(render-base-if-necessary!)
(go
;; initial load
Expand Down