Fork me on GitHub
#cljsrn
<
2019-11-12
>
joshmiller00:11:39

The bridging part is very simple; you call a JS function and get back a promise with an [error, result] pair.

joshmiller00:11:39

You should be able to just use FB’s native modules documentation for Android: https://facebook.github.io/react-native/docs/native-modules-android

joshmiller00:11:54

Once you have that, the JS->CLJS part is just normal interop.

ivana07:11:18

@joshmiller thanks alot, I'l learn your links!

👍 4
vikeri19:11:36

@ivana We have also integrated a lot of native modules without any major problems. As @joshmiller mentioned it’s not cljs specific at all but just normal js-interop. For many use cases there are libraries out there that integrate native modules for you. Camera for example: https://github.com/react-native-community/react-native-camera

👍 8
ivana19:11:37

Thanks, @vikeri! But espessislly for camera - I had tried to integrate library you mentioned several times, but without a success. I saw a lot of errors, which googled me to a batch issues in this github project, I found out that I should made some non trivial steps to bump its version, and so on... For example, some other libraries also have broken link procedure, and I had to guess what to change directly manually in .java and .gradle files, but in a case of camera I was unlucky and did not guessed.

vikeri19:11:59

@ivana I see, yeah a downside is that you will need to know your way around dependencies and some native code, especially on Android. But that you would need to do if you did native anyway. But if you don’t want to meddle too much with native libraries then I can recommend expo.

vikeri19:11:08

They have a camera module included.

ivana19:11:59

Thanks again, I know about expo, but it has many limitations. Thats why I desided to try make own native modules, to be independent from side packages, which were written not by me and theirs black-box unsolveable problems.

vikeri19:11:00

@ivana Yeah I get that, we’ve “insourced” some native libraries that we needed more control over or that were not maintained. The tooling is not trivial though and needs a decent investment upfront, but if you’re in it for a longer haul it might be worth digging into.

ivana19:11:15

@vikeri anyway, thanks alot! At least I can fork and reverse engeenere it, cause it opensource 🙂

vikeri19:11:39

That’s true, good luck

Kenric20:11:28

Hi, hopefully this is the right place for this question. I'm in the process of upgrading our project from RN 0.59.5 to 0.61.2. I've gotten the release build to work on device (android), but when I try running in debug (device or emulator), I'm seeing this error in the Metro Bundler:

error: bundling failed: Error: Unable to resolve module `WebSocket` from `figwheel-bridge.js`: WebSocket could not be found within the project.
Has anyone else come across this and/or know how to resolve this? Project was created with latest re-natal. Thanks!

joshmiller21:11:52

@kenric I actually just came across that in doing the same upgrade

joshmiller21:11:21

Websocket is included at the global level now; you can just comment out the line var Websocket = require('Websocket')

joshmiller21:11:38

(in figwheel-bridge.js, if that wasn’t clear)

joshmiller21:11:44

For anyone else thinking about a similar upgrade, almost everything I dealt with was on the RN/iOS side — there are a bunch of changes to how RN is packaged, it’s all in separate Pods now. There’s allegedly autorequiring where RN will just pull all the cocoapods in your node_modules/ in but it didn’t work for me. I may just have done it wrong.

Kenric21:11:23

@joshmiller Thanks for the info/fix!

👍 4