flexsurfer / conduitrn

Real world react native application built with clojurescript and re-frame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to add a view.

zendevil opened this issue · comments

I'm trying to return

{:dispatch [:set-active-page {:page :article
                                   :slug (:slug article)}]}

from an effect handler. I've added a new map with key and a component like so:

(defn root-stack []
  [safe-area/safe-area-provider
   [(rnn/create-navigation-container-reload                 ;; navigation container with shadow-cljs hot reload
     {:on-ready #(re-frame/dispatch [:initialise-app])}     ;; when navigation initialized and mounted initialize the app
     [stack/stack {:mode :modal :header-mode :none}
      [{:name      :main
        :component tabs}
       {:name      :sign-in
        :component signin/sign-in-modal
        :options   {:gestureEnabled false}}
       {:name      :settings
        :component settings/settings}
       {:name      :article
        :component article/article}
       {:name      :user-favorite
        :component home/fav}
       {:name      :user-articles
        :component home/user-articles}
       {:name      :tags
        :component tags/tags}
       {:name      :tag
        :component home/tag}



       {:name      :new-name           ;;; new key
        :component some-ns/my-component ;; new-component}]])]])


But when dispatching to [:set-active-page {:page :new-name}], I get the error:

"No matching clause, :new-name"

How to fix this error?

hi, if you want just to navigate to this page just use navigate-to event like so {:dispatch [:navigate-to :new-name]} , :set-active-pageis just specific event for this project, if you want you can use it as well , you need to modify it. then add a case for your new screen https://github.com/flexsurfer/conduitrn/blob/master/src/conduit/events.cljs#L30

It would be great if you can create a project creation script that creates this project with any given name.