Clojurians
#om
<
2017-02-22
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

qqq04:02:33

I find the wiki a bit too fast moving and looking for something that explains an app step by step

danielstockton07:02:05

@qqq you might want to look at #untangled and the community resources at the bottom of the wiki: https://github.com/omcljs/om/wiki

qqq08:02:18

@danielstockton : oh wow, untangled looks amazing

baptiste-from-paris15:02:10

Hello all, a little question with om.next on React Native (ios) using re-natal I am following the documentation on Navigator https://facebook.github.io/react-native/docs/using-navigators.html#using-navigator and I try to translate it to cljs. This code is working for this example =>

(defui MyScene
  Object
  (render [this]
          (let [{:keys [title onForward onBack]} (om/props this)]
            (js/console.log (om/props this))
            (view nil
                  (text {:style {:fontSize 20}} (str "Scene name is : " title))

                  (touchable-highlight {:onPress onForward}
                                       (text nil "Tap me to load the next scene "))

                  (touchable-highlight {:onPress onBack}
                                       (text nil "Tap me to Go back"))))))

(defonce my-scene (om/factory MyScene))

(def navigator (partial create-element (.-Navigator ReactNative)))

(defui AppRoot
  static om/IQuery
  (query [this]
         '[:app/msg])
  Object
  (render [this]
          (let [{:keys [app/msg]} (om/props this)]
            (navigator
             {:initialRoute {:title "My Initial Scene héhé"
                             :index 0}
              :renderScene (fn [route, navigator]
                             (my-scene {:title (.-title route)
                                        :onForward (fn []
                                                     (let [nextIndex (inc (.-index route))]
                                                       (.push navigator {:title (str "Scene " nextIndex)
                                                                         :index nextIndex})))
                                        :onBack (fn []
                                                  (if (pos? (.-index route))
                                                    (.pop navigator)))}))}))))
I am lost in making props required as in the example =>
MyScene.propTypes = {
  title: PropTypes.string.isRequired,
  onForward: PropTypes.func.isRequired,
  onBack: PropTypes.func.isRequired,
};
any ideas on how to do it ?