This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-20
Channels
- # announcements (3)
- # beginners (63)
- # calva (1)
- # cider (24)
- # clj-kondo (98)
- # cljdoc (8)
- # cljsrn (19)
- # clojure (106)
- # clojure-conj (2)
- # clojure-europe (5)
- # clojure-italy (5)
- # clojure-nl (8)
- # clojure-spec (8)
- # clojure-uk (13)
- # clojuredesign-podcast (7)
- # clojurescript (54)
- # core-async (1)
- # cursive (3)
- # data-science (1)
- # datomic (19)
- # fulcro (7)
- # hoplon (1)
- # off-topic (3)
- # re-frame (13)
- # reitit (1)
- # shadow-cljs (234)
- # test-check (10)
- # tools-deps (59)
- # unrepl (1)
- # yada (20)
hi ppl, I'm sending a parameter to routes but I cannot get the value on the other side. I have to following code on a cell in the first screen
:on-press (fn [] (.navigate (.-navigation (clj->js props)) "Details" {"itemId" 20}))
And when I clicked, I want to get the value in the next screen:
(defn details-screen [props]
(fn []
(println (.getParam (.-navigation (clj->js props)) "itemId"))
[view {:style {:flex 1 :justify-content "center" :align-tems "center"}}
[text "Details Screen!"]]))
I can even see the values are being passed correctly if I print the (.-navigation (clj->js props))
#js {:pop #object[Function], :popToTop #object[Function], :push #object[Function], :replace #object[Function], :reset #object[Function], :dismiss #object[Function], :goBack #object[Function], :navigate #object[Function], :setParams #object[Function], :state #js {:params {itemId 20}, :routeName Details, :key id-1566266752816-3}, :router nil, :actions #js {:pop #object[pop], :popToTop #object[popToTop], :push #object[push], :replace #object[replace], :reset #object[reset], :dismiss #object[dismiss], :goBack #object[goBack], :navigate #object[navigate], :setParams #object[setParams]}, :getParam #object[Function], :getChildNavigation #object[getChildNavigation], :isFocused #object[isFocused], :isFirstRouteInParent #object[isFirstRouteInParent], :dispatch #object[Function], :getScreenProps #object[Function], :dangerouslyGetParent #object[Function], :addListener #object[addListener], :emit #object[emit]}
Hey, how can we manage state
in React native with clojurescript. For example:
[:> rn/Input {:placaeholder "search"
:onChangeText #(...)} ]
As we know, the phone input
use :onChangeText
to watch user's type, and it looks like it will rerender automatically even if we don't set :onChangeText
and :value
props. But sometimes, we will need to manipulate the input value
, such as a clear button. How can do it?@iagwanderson I think your problem with getParam
is that you have a CLJ map {"itemId" 20}
, which getParam
as a JS function doesn’t know how to read into.
But I don’t think there’s much reason to use getParam
from CLJS, I never do. There’s nothing wrong with treating props
as data and just walking into that data structure like a normal Clojure person.
@joshmiller yes, in the end I did (.-params (.-state (.-navigation (clj->js props))))
and it works just fine
I'm trying to make a request to a backend api (localhost:3000) but I cannot find the origin of the error: {:status 0 :status-text 'Request failed', :failure :failed}
I had a similar issue inside a re-frame app recently where the problem was related to enabling cors
on my backend
The device/simulator probably has its own IP
From its perspective, your locally running server is probably at whatever internal IP your machine has
Don’t forget you might need to whitelist that for non-secure connections, depending on your setup
iOS definitely makes you do that, not sure about Android
from time to time when I add a new npm dependency I get an error message
Failed to Fetch: - Perhaps your project was cleaned and you haven't recompiled?
The process I follow is 1) run npm install <package> --save
2) react-native link 3) require the dependency inside my project E.x. (js/require "react-native-action-button") 4) re-natal use-figwheel
(which finds the required package and adds it to index.android.js
) and finally lein figwheel android