Fork me on GitHub
#cljsrn
<
2016-08-11
>
caio07:08:26

how do i use re-natal with react-native-sound? i'm in a middle of a hackathon, so i don't have much time to experiment, sry 😄

caio07:08:55

(not a real hackathon; it's sth me and a friend implementing some ideas)

caio07:08:24

@artemyarulin: yeah, but idk what's the component :thinking_face:

artemyarulin07:08:35

I don’t use re-natal but I guess you can try npm install react-native-sound —save && re-natal use-component react-native-sound and then require it as (def rn-sound (js/require “react-native-sound”))

vikeri07:08:50

Possibly a rnpm link step involved as well. Don’t remember exactly.

artemyarulin07:08:15

oh yeah, if library has some native code (react-native-sound does) then it’s needed

artemyarulin07:08:40

I thought re-natal does exactly that behind use-component command?

caio07:08:56

ok, what's rnpm? sry, itƛ been a long time since i've use re-natal

artemyarulin07:08:41

oh, actually don’t bother to google it, it was merged to react-native already 🙂 react-native link react-native-sound - run this in the root of your project

caio07:08:44

and react-native-sound uses some object instantiation. idk how i'm supposed to use it after I do re-natal use-component react...

caio07:08:49

i'd be fine using it as a library, but for using objects from that lib, i have no idea :thinking_face:

artemyarulin07:08:07

what do you mean by objects? objects in JS?

caio07:08:47

var s = new Sound('advertising.mp3', Sound.MAIN_BUNDLE, (e) => {...bleh...})

artemyarulin07:08:23

yeah, it’s just js interop, nothing unusual there

caio07:08:00

hm, ok. thanks @artemyarulin and @vikeri for the help :punch:

artemyarulin07:08:34

good luck with hackathon - cljs +rn brings a lot of fun usually 🙂

caio08:08:12

it says Requiring unknown module 'react-native-sound' trying to call (def rn-sound (js/require "react-native-sound"))ï»żâ 

vikeri08:08:03

Test restarting RN packager and do re-natal use-figwheel

caio08:08:16

hm, ok. whatƛ the reasoning behind it? it seems too much magic is going on behind re-natal cmds 😕

vikeri08:08:47

It’s related to how the RN packager works. It scans your files for require statements. And re-natal indeed does some magic to comply with that.

caio08:08:40

Can't find variable: rn_sound facepalm

pesterhazy09:08:20

the RN packager, unfortunately, is full of magic, both good and bad

tianshu09:08:26

for re-natal, is the cnt , reloader , root-el in env.ios.main necessary ?

martinklepsch10:08:46

another cljs + react native project

nilrecurring10:08:06

Do we have an index to all the other cljsrn apps around?

vikeri11:08:35

@ilmirajat: Where have you been all this time? Great work!

caio17:08:51

about react-native-sound: actually, re-natal use... doesn't work for using it, and I needed to make some changes on the native code. everything is working fine now, thanks for the help 🙂

ilmirajat19:08:24

@vikeri: Thanks. I'm newbie in clojure and this is my first "real" project with Clojure. (To be honest, one motivator to use ClojureScript in the app, was to become fluent in Clojure.)

pesterhazy20:08:46

@ilmirajat: did you write the trustroots app?

ilmirajat20:08:59

Btw. do any of you have good refence how unit tests code properly in Cljsrn. The best reference I've found, is this https://github.com/futurice/pepperoni-app-kit. It uses Enzyme (https://github.com/airbnb/enzyme) and React-native-mock for mocking hardware. It was pure pain to get unit tests work reasonably well, and I'm not quite satisfied to my solution.

ilmirajat20:08:58

@pesterhazy: Me and Tarmo Aidantaus (bleadof in github). We do it mostly as pair programming and use one evening per week for it.

ilmirajat20:08:05

If we continue this pace, MVP is ready within few months.

artemyarulin20:08:00

We’ve discusses testing theme a bit before here - nothing “production ready”. I guess official RN way would be https://facebook.github.io/jest/blog/2016/07/27/jest-14.html, although now it’s experimental

pesterhazy20:08:16

we've used Kif on iOS, using accessibility hints

pesterhazy20:08:45

to be honest, it was hard to get to work, and too unreliable

pesterhazy20:08:15

we ended up giving up on it, testing manually instead 🙂

artemyarulin20:08:47

oh yeah, UI testing should be the latest step - it’s too fragile

ilmirajat20:08:51

For me it was easier to get Mocha + Enzyme + React-native-mock to work. Facebook uses Jest, but for me it looked laborious to configure and there was no good and clear examples...

artemyarulin20:08:16

yep, documentation either sucks or doesn’t exists

pesterhazy20:08:31

for UI work I'm not convinced unit tests are very helpful

pesterhazy20:08:54

I mean most of the complexity in UIs is in the interconnection of components

pesterhazy20:08:12

and in the interplay with the runtime (browser or RN)

ilmirajat20:08:53

My main priority is to test handlers and subscribtions, and hardware related logic.

pesterhazy20:08:31

I agree it would be nice to have!

ilmirajat20:08:20

UI is too laborious to test. This is non-profit, community project, so I let community to do it.

boorad21:08:53

@pesterhazy: clearing packager cache did the trick. Maybe add to your blog post ‘troubleshooting’ section?

boorad21:08:13

find $TMPDIR -name "react-*" -exec rm -rf {} \;

Tim21:08:26

@pesterhazy hm, maybe not strict unit tests, but having tests that test the interaction between components?