This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-07
Channels
- # announcements (12)
- # aws (2)
- # beginners (233)
- # calva (68)
- # cider (23)
- # circleci (5)
- # clj-kondo (40)
- # cljsrn (4)
- # clojars (3)
- # clojure (200)
- # clojure-austin (1)
- # clojure-canada (1)
- # clojure-dev (16)
- # clojure-europe (1)
- # clojure-finland (1)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-spec (3)
- # clojure-uk (102)
- # clojurescript (16)
- # cursive (14)
- # datomic (16)
- # figwheel-main (7)
- # graalvm (3)
- # hoplon (37)
- # jackdaw (23)
- # jobs-discuss (24)
- # joker (4)
- # kaocha (6)
- # keechma (64)
- # off-topic (66)
- # parinfer (1)
- # pedestal (7)
- # re-frame (7)
- # reagent (10)
- # reitit (45)
- # rewrite-clj (12)
- # shadow-cljs (1)
- # slack-help (8)
- # spacemacs (55)
- # sql (9)
- # tools-deps (9)
- # vim (7)
Hi all, I'm having a pretty challenging time getting React Navigation to work in my app. The error I'm getting is that "The component for route 'meta' must be a React component". I'm a little bit confused by the error message because I don't have a 'meta' route (I only have the single :dashboard
route)
(def rn (js/require "react-navigation"))
(defn simple-reagent-comp []
[(r/adapt-react-class (.-Text rn)) "Hello"])
(def route-config {:dashboard {:screen (r/reactify-component simple-reagent-comp)}})
(def createStackNavigatorFn (. nav -createStackNavigator))
(def createAppContainerFn (. nav -createAppContainer))
(defn app-navigator []
(print "REACTIFY" (r/reactify-component simple-reagent-comp))
(createStackNavigatorFn route-config))
(defn app-root []
(fn [] [(r/adapt-react-class (app-navigator))]))
(defn init []
(dispatch-sync [:initialize-db])
(ocall expo "registerRootComponent" (r/reactify-component app-root)))
Borrowed some code from @emilior's example above and got it working. I neglected to clj->js
the route-config that was passed to the create(Stack|Drawer|Switch)NavigatorFn
. Also a silly mistake in there where I had both nav
and rn
defined for (js/require "react-navigation)
but tried to use (.-Text rn)
(def nav (js/require "react-navigation"))
(def rn (js/require "react-native"))
(defn simple-reagent-comp [{:keys [navigation state]}]
(fn [{:keys [navigation state]}] [ (r/adapt-react-class (.-Text rn)) "Hello"]))
(def route-config {:dashboard {:screen (r/reactify-component simple-reagent-comp)}})
(def createStackNavigatorFn (. nav -createStackNavigator))
(def createAppContainerFn (. nav -createAppContainer))
(def createDrawerNavigatorFn (. nav -createDrawerNavigator))
(def drawerNavigatorOptions
{:drawerWidth 300
:drawerPosition "left"
:drawerBackgroundColor "#c0c0c0"
:drawerType "front"
:edgeWidth 10
:contentComponent (r/reactify-component simple-reagent-comp)})
(defn app-root []
(let [app (createAppContainerFn (createDrawerNavigatorFn
(clj->js route-config)
(clj->js drawerNavigatorOptions) ))]
(fn [] [(r/adapt-react-class app)])))
(defn init []
(dispatch-sync [:initialize-db])
(ocall expo "registerRootComponent" (r/reactify-component app-root)))
Anyone using the Google sign-in module from Expo? https://docs.expo.io/versions/v31.0.0/sdk/google/ I'm able to trigger the system web browser and select a Google account with the following code. After selecting an account, Google redirects me back to Expo as expected. However, I never see the js/console.log
get triggered, which makes me wonder what exactly happens to the request
(def expo (js/require "expo"))
(def google-auth (.-Google expo))
(defn some-comp []
[touchable-highlight
{:onPress (fn []
(let [android-client-id "my_android_client_id"
config {:androidClientId android-client-id
:scopes ["profile" "email"]}]
(-> (.logInAsync google-auth (clj->js config))
(.then #(js/console.log %))
(.catch #(js/console.log %)))
))}
[text "Google Sign In"]] )