This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-14
Channels
- # beginners (31)
- # boot (9)
- # cider (10)
- # cljs-dev (9)
- # cljsrn (16)
- # clojure (222)
- # clojure-austin (4)
- # clojure-france (13)
- # clojure-italy (21)
- # clojure-nl (2)
- # clojure-russia (71)
- # clojure-spec (9)
- # clojure-uk (39)
- # clojurescript (50)
- # cursive (16)
- # datomic (69)
- # dirac (2)
- # figwheel (1)
- # graphql (19)
- # hoplon (4)
- # jobs (1)
- # klipse (3)
- # leiningen (4)
- # liberator (3)
- # luminus (9)
- # lumo (9)
- # off-topic (3)
- # om (21)
- # onyx (11)
- # parinfer (2)
- # pedestal (8)
- # planck (19)
- # re-frame (17)
- # reagent (12)
- # remote-jobs (1)
- # ring-swagger (3)
- # spacemacs (17)
- # specter (23)
- # sql (1)
- # unrepl (64)
- # untangled (19)
- # yada (5)
I use Android sdk's emulator (not Genymotion) and my Android. Both don't show the menu that way.A̶n̶y̶w̶a̶y̶,̶ ̶a̶f̶t̶e̶r̶ ̶u̶s̶e̶ ̶i̶O̶s̶ ̶s̶i̶m̶u̶l̶a̶t̶o̶r̶ ̶t̶o̶ ̶d̶i̶s̶a̶b̶l̶e̶ ̶l̶i̶v̶e̶ ̶r̶e̶l̶o̶a̶d̶,̶ ̶I̶ ̶c̶a̶n̶ ̶s̶w̶i̶t̶c̶h̶ ̶b̶a̶c̶k̶ ̶t̶o̶ ̶A̶n̶d̶r̶o̶i̶d̶ ̶e̶m̶u̶l̶a̶t̶o̶r̶.̶ ̶H̶e̶n̶c̶e̶ ̶d̶i̶s̶a̶b̶l̶i̶n̶g̶ ̶l̶i̶v̶e̶ ̶r̶e̶l̶o̶a̶d̶ ̶h̶a̶p̶p̶e̶n̶e̶d̶ ̶i̶n̶ ̶s̶e̶r̶v̶e̶r̶ ̶s̶i̶d̶e̶,̶ ̶n̶o̶t̶ ̶t̶h̶e̶ ̶e̶x̶p̶o̶ ̶c̶l̶i̶e̶n̶t̶ ̶s̶i̶d̶e̶ ̶ => I was wrong about this
Hi all! I'm trying to use react-navigation, but I cannot make it work.. 😞 can anyone put a simple snippet as example? (possibly without re-frame ) thanks!
@manu there are probably better ways to use react navigation, but this seems to be the simplest:
(defn create-nav [navigator-fn conf _]
(let [vscreens (volatile! nil)
rfn (r/reactify-component #(->> %
clj->js
get-screen-key
(get @vscreens)
(r/as-element)))
_ (oset! rfn "!navigationOptions" #(->> %
get-screen-key
(get @vscreens)
meta
clj->js))
; TODO remove this dirty hack
routes-conf (to-array (for [_ (range 10)] #js {:screen rfn}))
jsconf (clj->js conf)
nav (r/adapt-react-class (navigator-fn routes-conf jsconf))]
(fn [{:keys [index dispatch-fn] :as conf} screens]
(do (vreset! vscreens (filterv vector? screens))
(let [c (count @vscreens)
dfn #(when dispatch-fn
(-> % (js->clj :keywordize-keys true) dispatch-fn))
routes (to-array (for [i (range c)]
#js {:key i ;TODO this throws a type exception
:routeName (str i)
:params #js {:blubb i}}))
navigation #js {:dispatch dfn
:state #js {:index (or index (dec c))
:routes routes}}
navigation-hs (addNavigationHelpers navigation)]
;(doseq [i (range c)]
; (.setParams navigation-hs #js {:params #js {:key i}
; :key i}))
(js/console.timeEnd "detail")
[nav {:navigation navigation-hs}])))))
(defn stack-nav [conf cards]
(create-nav StackNavigator conf cards))
(defn tab-nav [conf tabs]
(create-nav TabNavigator conf tabs))
u can then use it like that:
[uic/stack-nav
{:navigationOptions {:headerStyle (s :aboveBackground {:height 35
:padding-top 0})
:headerTitleStyle (s :title)
:headerBackTitleStyle (s :title :highlight)
:headerTintColor highlight-color}
:dispatch-fn #(if info?
(dispatch [:toggle-mxinfo mxid])
(dispatch [:select-mx nil]))}
[^{:header nil} [view {:style (s :background-view)}
[selection app-db]]
(cond
(and mxid info?)
^{:title "Details"
:headerRight (header-right-mx-info mxid)}
[mx-info ok-tup mxcur]
mxid
^{:title detail-title
:headerRight (header-right mxid)
:headerBackTitle "Back"
:headerTruncatedBackTitle "Back"}
[view {:style (s :background-view)}
[detail ok-tup mxid]])]
@ronb I tried to follow the example in this page https://facebook.github.io/react-native/docs/navigation.html, but with rendering just one page, like
but I got this error { [Invariant Violation: Route 'children' should declare a screen. For example: import MyScreen from './MyScreen'; children: { : screen: MyScreen, }]
@manu you need to reactify Myscreen and call StackNavigator directly without calling adapt-react-class first. i had exactly the same confusion when first learning about react-navigation. the api is quite strange
https://github.com/re-native/re-native-navigation maybe this API is more clear, but i haven’t used that project
@mfikes I have turned on :advanced
compilation on my react-native project. it helps a lot with react-native bundle
step (30min -> 3min) and the code seems to run quicker as well. although i have not carefully benchmarked before and after. My app seems to be a lot more responsive with advanced compilation turned on