This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-12
Channels
- # beginners (85)
- # boot (7)
- # cider (7)
- # clara (1)
- # cljsrn (49)
- # clojure (85)
- # clojure-dev (19)
- # clojure-dusseldorf (15)
- # clojure-greece (1)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-russia (21)
- # clojure-sanfrancisco (1)
- # clojure-spec (25)
- # clojure-uk (59)
- # clojurescript (29)
- # core-async (5)
- # core-matrix (1)
- # css (1)
- # datomic (1)
- # docker (10)
- # fulcro (12)
- # graphql (21)
- # hoplon (7)
- # jobs-rus (6)
- # jobs_rus (1)
- # lein-figwheel (1)
- # mount (5)
- # off-topic (6)
- # om (4)
- # onyx (8)
- # perun (1)
- # portkey (25)
- # protorepl (7)
- # re-frame (78)
- # reagent (24)
- # ring-swagger (32)
- # rum (3)
- # schema (1)
- # shadow-cljs (122)
- # spacemacs (3)
- # specter (2)
- # sql (1)
- # testing (1)
- # uncomplicate (2)
- # yada (14)
Hi, im currently using cljs for react-native app and having some issue in the interop of HighOrderComponent. The library i want to use is : https://github.com/okgrow/react-native-joyride This the the js code i wanna interop:
import { joyride } from 'react-native-joyride';
class HomeScreen extends Component { /* ... */ }
export default joyride()(HomeScreen);
I have a function that has the homescreen page component,im facing difficulty in export statement.
Any help would be appreciated 😃@U61HA86AG i have used (def ^:export filename)
but yes i cannot find a way to export it as default
^:export
just means it will retain its full path in the final js (e.g some.namespace.foo()
)
@U61HA86AG okay cause i seem to be getting the following issue:
[Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.]
I googled this and it normally happens with incorrect import/export. Dont know what to do 😞@U61HA86AG This is the only library i found that gives me a tourguide/ walkthough for new users, do you know any similar library that does that?
@U61HA86AG this is my updated code for which i am getting the above error:
(def joy (.joyride JoyRide))
(def JoyrideStep (r/adapt-react-class (.-JoyrideStep JoyRide)))
(def JoyrideText (r/adapt-react-class (.joyridable JoyRide (r/reactify-component (.-Text ReactNative)))) )
(defn ^:export joyride-page []
[view
[JoyrideStep (clj->js {:text "Hey! This is the first step of the tour!"
:order 1
:name "openApp"})
[JoyrideText "Welcome to the demo of joyride library"]])
(defn m-joyride-page []
(let [m (-> joyride-page
r/reactify-component
joy
r/adapt-react-class)]
[m]))
The flow is going till joyride-page but it seems JoyRideStep is causing the error.if view
is defined, and JoyRideStep
is undefined, then that means that (def JoyrideStep (r/adapt-react-class (.-JoyrideStep JoyRide)))
is not doing what you expect
@U61HA86AG (def JoyrideStep (r/adapt-react-class (.-JoyrideStep JoyRide))
is taking joyride step and converting into react component wrapper
@U61HA86AG i have defined view in similar way (def view (r/adapt-react-class (.-View ReactNative)))
and it seems to be working
i figured, but if it's undefined (as per the error you got), then there must be something wrong with it, right?
@U61HA86AG I agree, im stuck on that because it should work as it is supposed to but it isnt, i thought it a js<->clj interop issue but i doubt that too
how are you requiring JoyRide
? it might be (.-JoyrideStep js/JoyRide)
or JoyRide/JoyrideStep
instead
This is how im requiring JoyRide (def JoyRide (js/require "react-native-joyride"))
JoyRide/JoyrideStep
I dont think so this works in cljs
hmm, in that case i think it should work, perhaps you need to (.log js/console JoyRide)
and validate your assumptions
@U61HA86AG i tried replacing it to (def JoyrideStep (r/adapt-react-class JoyRide/JoyrideStep))
but i get this issue
[TypeError: undefined is not an object (evaluating 'expo_demo.core.JoyRide.joyride')]
I guess joyride
is undefined
@U61HA86AG sorry you were right it was a js/require silly issue i made . This is the error i get [ReferenceError: Can't find variable: JoyRide]
using log on joyride gives me this
Object {
"JoyrideStep": [Function JoyrideStep],
"joyridable": [Function joyridable],
"joyride": [Function joyride],
}
@U61HA86AG im getting the following Object only after changing it to .-JoyrideStep
log on JoyrideStep gives me
{
"class": null,
"id": null,
"name": [Function JoyrideStep],
}
It seems im getting null on JoyrideStep
and log on JoyrideText gives
{
"class": null,
"id": null,
"name": [Function anonymous],
}
then i suppose you might need to do (def JoyrideStep (.-name (.-JoyrideStep Joyride))
i dont have to convert it by (r/adapt-react-class)
?
@U61HA86AG using
(def JoyrideStep (.-name (.-JoyrideStep JoyRide)))
(def JoyrideText (.-name (.joyridable JoyRide (r/reactify-component (.-Text ReactNative)))))
gives the following issue : Error rendering component (in env.main.reloader > expo_demo.core.app_root > m-joyride-page > > expo_demo.core.joyride_page)
15:58:40
[Error: Assert failed: Invalid tag: '' (in env.main.reloader > expo_demo.core.app_root > m-joyride-page > > expo_demo.core.joyride_page)
tag]
So i need to use (r/adapt-react-class)
using
(def JoyrideStep (r/adapt-react-class (.-name (.-JoyrideStep JoyRide))))
(def JoyrideText (r/adapt-react-class (.-name (.joyridable JoyRide (r/reactify-component (.-Text ReactNative))))))
gives me the following error : [Invariant Violation: Expected a component class, got [object Object].]
and log of JoyrideStep and JoyrideText of the same is {
"class": null,
"id": null,
"name": "JoyrideStep",
} {
"class": null,
"id": null,
"name": "",
}
@U61HA86AG np btw could you explain me why (.-name) had to be used? i dont know js actually
i just figured that you needed the component function, which seemed to be under the name
property of that object. was a complete guess 😛
@U61HA86AG oh so when are the cases in which we need to use (.-name). I have used many libraries but never need to use this
that object you posted had the property name
, which had a function value. the others were both null
, so i guessed that you needed the function. to get the name
property of a js object you use the .-name
interop syntax
@U61HA86AG i understood for JoyrideStep but for JoyrideText has name earlier as [anonymous function] so how to access this?
and after using (.-name) on JoyrideText the name is ""
@U61HA86AG JoyrideText must already be a function
means?
so you mean to say JoyrideText is a function and not object?
@U61HA86AG so i cannot use (.-name) in JoyrideText
true but it did change my error from
[Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.]
to [Invariant Violation: Expected a component class, got [object Object].]
so i think that was the correct direction
@U61HA86AG thanks alot for your help
@U61HA86AG i just found out there is a dedicated channel #cljsrn for react native using cljs ill try posting it there
I do not believe so. I mean, Slack is designed as an invite-only system isn't it, although there are some automated tools people have written around that to allow anyone to sign up
But I suspect the expectation is if you get spammed you just uninvite/ban the user from your Slack workspace
@wilcov the recent slack @everyone disabling was evidence of how slack views "open" systems
Never seen it so quiet in here. I guess everyone is having their minds 💥 at the conj.
that was fast: https://www.youtube.com/watch?v=2V1FtfBDsLU (conj rh keynote)
Is there a trick for (in constant time) turning a LazySeq that’s already fully realized into an IPersistentList? I’m assuming there’s nothing smarter than reify.
why are you targeting that specific interface?
unsure who runs ClojureTV on Youtube, but this talk is mislabled: https://www.youtube.com/watch?v=B_ubbbm9cRg. The title claims it is "Homoiconicity : It Is What It Is" by Stuart Sierra but the video is "Learning Clojure and Clojurescript by playing a card game" by Gijs Stuurman
That’s been fixed. BTW, Stuart’s talk had a technical issue with audio, so he will re-do the audio and it’ll get posted in a day or so.
“It’s hard enough to drive a car. If you’ve got to understand monads too …“ 😄
That’s been fixed. BTW, Stuart’s talk had a technical issue with audio, so he will re-do the audio and it’ll get posted in a day or so.