Fork me on GitHub
#cljsrn
<
2017-04-11
>
etherfuse05:04:11

I'm going with this route....I had no idea

leonmanrolls05:04:36

Hello! Any advice on how to access the device's accelerometer (Android) with re-natal? I'm tyring to use this https://github.com/kprimice/react-native-sensor-manager which I think is a 'NativeModule' but I can't find any documuntation on NativeModules, and following the procedure for components hasn't worked for me so far.

leonmanrolls05:04:53

As per the instructions in that repo i try to require 'NativeModules' but it can't be found

leonmanrolls05:04:25

Hey @misha thanks for the response

leonmanrolls05:04:44

okay thanks i'll look into it

leonmanrolls06:04:10

phew okay thanks, looks like i'm in for more than i bargained for

leonmanrolls06:04:37

so just curious that repo i posted, is it incomplete? do you always need a js wrapper?

misha06:04:02

no idea 🙂

misha06:04:03

usually, repos have both android and ios wrappers included. so you just npm install ... and js/require(...) them.

misha06:04:44

I did not use enough of 3rd party libs myself yet

leonmanrolls06:04:06

I've tried (def NativeModules (js/require "NativeModules"))

misha06:04:22

I suggest you to go through the docs anyway. At this point I am guessing too

misha06:04:56

@leonmanrolls did you follow lib installation steps from that repo?

misha06:04:14

$ npm i react-native-sensor-manager --save
rnpm link

leonmanrolls06:04:25

yes, well i did react-native link

leonmanrolls06:04:21

and when i run 'react-native run-android' the classes show up

misha06:04:42

this is an import of (ios) lib I wrote myself:

(def ReactNative (js/require "react-native"))
(def ^:private NativeModules (.-NativeModules ReactNative))
(def ^:private DSS (.-DSS NativeModules))

leonmanrolls06:04:23

ah that looks promising i'll try that

leonmanrolls06:04:59

Great so this worked! (def SensorManager (.-SensorManager (.-NativeModules ReactNative)))

leonmanrolls06:04:06

Do you think it's worth adding this to the re-natal docs?

savelichalex07:04:06

@misha How this works "react-native.-NativeModules.-SensorManager"? :thinking_face:

misha08:04:23

Did not wake up yet, it should not work opieop

acgt15:04:55

Hey guys -- I have a project set up using re-natal, but I'm having trouble getting a test suite working. The included test stub isn't even clojurescript. How have you approached getting unit tests running?

pesterhazy15:04:05

personally I've concluded that integration testing isn't worth it for small teams when using react native

pesterhazy15:04:25

because it's hard to make reliable

acgt15:04:26

not even trying to do integration tests... I just have a few very sensitive functions I want to make sure I unit test

acgt15:04:33

Not testing the UI at all

pesterhazy15:04:49

for that you should be able to use regular clojurescript testing tools

acgt15:04:41

so, I've replaced the stub with cljs.test-based tests...

acgt15:04:15

But it's unclear how to get the thing running. I have a figwheel repl, but I don't think the /test directory is even in the environment

acgt15:04:47

I'm afraid of manually changing a bunch of the project.clj settings, because I think they're auto-generated somehow by re-natal

pesterhazy15:04:43

hm I don't know about that because I use boot-react-native

pesterhazy15:04:01

but some others in this channel may be able to help

acgt15:04:35

hmm, ok - thanks. I'll stick around 🙂

etherfuse17:04:05

I'm interested in a good approach to testing as well. I've started to look at Jest but don't see a straight forward approach