Fork me on GitHub
#cljsrn
<
2016-01-26
>
donmullen00:01:32

@alwx: Nice! Thanks for sharing.

mfikes00:01:54

@donmullen: Updated the site!

mfikes00:01:16

Automated with Planck šŸ˜Ž

donmullen00:01:30

cljs for the win

seantempesta01:01:10

Do all om-next ui components have to be declared in the same namespace? Iā€™ve been trying to move components to separate namespaces and they just produce errors. Maybe because in the other namepace I require om-next and thatā€™s overwriting something?

jimmy01:01:45

@seantempesta: No, you dont need to declare all components in the same namespace.

podviaznikov06:01:55

Iā€™m just starting to use Natal, Om.Next for first test app. I want to use Firebase. How do I include Firebase dependency? Should I install it using npm install firebase ā€”save or should I add it to the project.clj like [cljsjs/firebase "2.2.3-0ā€]? Any quick tips?

artemyarulin06:01:24

@podviaznikov: Hm, firebase is a remote storage isnā€™t it? So basically you can try then to use cljsjs/firebase. It will make XMLHttpRequest which is fully available on RN environments

artemyarulin06:01:39

Even you can do npm install for RN, not all of the libraries can be installed - itā€™s not a NodeJS environment at the end after all

drapanjanas07:01:54

@alwx: Thanks a lot for this awesome example app!!!

podviaznikov07:01:45

Hm, itā€™s interesting. I think I have everything setup, but I cannot read or write so far from/to Firebase. And I see no errors so far in a repl. So itā€™s hard to figure out what I did wrong

artemyarulin07:01:28

Try to debug in Chrome and check all the network requests

artemyarulin07:01:35

if there is any

artemyarulin07:01:11

offtopic: https://github.com/galdolber/clojure-objc Just wow, didnā€™t know about that. Basically in case there is a need to write a native plugin for RN - we can still use Clojure, omg šŸ˜„

alwx07:01:59

@drapanjanas: @donmullen: You're welcome. Hope it will help people to start writing mobile applications in cljs

podviaznikov07:01:00

any idea what the reason might be?

dvcrn07:01:35

@podviaznikov: the library you are using probably does something with the document

dvcrn07:01:41

and that, well, doesnā€™t exist in react native

dvcrn07:01:23

if itā€™s just saving variables into the document and doesnā€™t do DOM actions, you could fake it by manually setting js/document before initialising firebase but not sure that will work

dvcrn07:01:35

alternatively, I am sure there are firebase clients for clojurescript out there

podviaznikov07:01:12

@dvcrn: thanks. I tried https://github.com/crisptrutski/matchbox yesterday also without luck of reading/writing to firebase. I used this library both from Clojure(server-side) and ClojureScript(frontend) before. But Iā€™m having trouble making it work with React native

podviaznikov07:01:53

Yeah, it seems like firebase should just work out of the box. That is why I assume Iā€™m doing something completely stupid. But I canā€™t figure out what

dvcrn07:01:48

using latest version? šŸ˜›

dvcrn07:01:07

how are you pulling it in? are you using the commonjs require() call?

dvcrn07:01:35

(def fb (js/require ā€œfirebaseā€))

podviaznikov07:01:10

imports from project.clj

[cljsjs/firebase "2.2.3-0"]
                 [matchbox "0.0.8-SNAPSHOTā€]

podviaznikov07:01:45

my requires

(:require [om.next :as om :refer-macros [defui]]
            [cljsjs.firebase :as firebase]
            [matchbox.core :as m])

podviaznikov08:01:13

(set! js/React (js/require "react-native/Libraries/react-native/react-native.jsā€))
(def firebase-ref (js/Firebase. "ā€))

dvcrn08:01:28

(def firebase-ref (js/Firebase. "))
then why are you using it through js/Firebase? couldnā€™t you just use the imported firebase?

dvcrn08:01:58

(just guessing. I never used firebase)

alwx08:01:56

re-natal use-component firebase

dvcrn08:01:06

yeah if you use the node module you have to fix the packager with that

dvcrn08:01:11

but I thought you use the cljsjs version

dvcrn08:01:17

with that it shouldnā€™t be necessary

podviaznikov08:01:57

no, I tried 1)

(def fb (js/require "firebaseā€))
2) I tried cljsjs version and I tried 3) matchbox which is wrapper. All 3 times I had no success

dvcrn08:01:07

all 3 are giving you the same document error?

drapanjanas09:01:38

Current version of firebase in npm is 2.4.0 while cljsjs version is 2.3.1 maybe older version does not work with react native? So probably you have to use latest npm version. But not sure how to properly require that in natal

artemyarulin17:01:29

@seantempesta: What are you using? natal/renatal, reagent?

seantempesta18:01:05

re-natal + om-next

artemyarulin18:01:04

Hm, React ref initialised here https://github.com/omcljs/om/blob/master/src/main/om/next.cljs#L341, not sure that you can affect it spoil it from the code anyhow

artemyarulin18:01:22

make sure that you have latest om, just in case

artemyarulin18:01:18

no, Iā€™m wrong, you can use :ref in many cases actually

kahunamoore20:01:29

I posted the following to the cljs mailing list but then realized I should have inquired here first... any thoughts? I'm prototyping a native version of an existing webapp that uses a Canvas element to display video (raw RGBA frames @ ~20fps) obtained via a websocket. The native version is built using re-natal (kudos!) and I'm able to connect to the websocket and obtain the ArrayBuffer. So far so good... unfortunately, the RN Image component only provides a source/URL property for the image source that it will use to download/decode images. But I already have the data. Of course I could transform my image data to a base64 encoding and use a data url but, eeewww. I just need a surface I can draw the raw image data onto. How hard can that be? Does anyone have an alternate suggestion for displaying a series of images quickly and efficiently. I'm looking over some of the RN opengl components - does anyone have experience using any of them? Suggested libraries? Flipboard has some components that look ok... I'm still evaluating them. Is there another RN component I'm overlooking? A different technique altogether? My next step is to create my own RN component to do this. I was just hoping to avoid that by using existing libraries/components.

artemyarulin20:01:17

@kahunamoore: There is a thing called arc, donā€™t know where the docs, but here example usage from the issue https://github.com/facebook/react-native/issues/5456

artemyarulin20:01:46

not sure that it can be used for video, but I guess this is a canvas alternative

artemyarulin20:01:08

not sure that I follow, can you show.. am, video?

marty.penner20:01:40

Iā€™ve seen a demo by David Nolen himself using Ejecta w/ Ambly: https://www.youtube.com/watch?v=ByNs9TG30E8&amp;feature=youtu.be&amp;t=35m30s

marty.penner20:01:58

Not sure if thatā€™s the integration youā€™re looking for, but looks very promising

kahunamoore20:01:31

Cool - thanks! I'll take a look. I remember him mentioning RN and opengl/cljs working prototype in one of his talks but was unable to find the reference.

kahunamoore20:01:53

Just to clarify the use case. The websocket is sending video frames (raw RGBA data) one after the other and the original webapp displays each frame on a canvas one after the other as fast as they come in. Just trying to do the same thing with RN/cljs

kahunamoore20:01:06

Sounds weird, I know. The source is an embedded system that doesn't have the CPU to encode the video and use normal video protocols... this was a hack that worked for our limited use.

marty.penner20:01:10

Sounds interesting. I definitely donā€™t have the immediate knowledge on how to draw raw RGBa data to a canvas using opengl in CLJS, but it seems possible

kahunamoore20:01:10

In the browser based webapp it boils down to ctx.putImageData(clampedArrayView,0,0); where ctx is the canvas drawing context.

kahunamoore20:01:43

Thanks for the link!

alwx21:01:18

Hey guys. I know, if you use Frappe to shake Android devices, you may be tired of clicking "Reload JS" or "Debug JS" using React Native context menu. I've forked Frappe and solved this problem. It is much easier to reload JS or start debugging now. https://github.com/alwx/milkshake

jurgen_photek22:01:56

@alwx thanks for sharing. I've been looking around for more examples. sadly I can't get this working in xcode simulator ... luno-react-native/ios/luno.xcodeproj Applications using launch screen files and targeting iOS 7.1 and earlier need to also include a launch image in an asset catalog. in case you have any idea how to fix that please inform.

drapanjanas22:01:49

@jurgen_photek: I guess if you have just checked out the repo you need to run npm install first to download all deps

jurgen_photek22:01:58

thanks, I gave that a go but getting an error on running.... but poking about I realise I have problems that are not specific to this luno proj. re-natal init Mynextproj creates a new project and looks to be fine. then open it in xcode, then running, I get

2016-01-26 22:52:20.026 [error][tid:main] {"type":"InternalError","message":"react-packager has encountered an internal error, please check your terminal error output for more details"}
now i installed re-natal for the first time a few days ago and created and ran a new project in xcode fine.... I guess I upgraded it since then so perhaps a new version has caused me problems. I'll try downgrading and see if that works

drapanjanas23:01:36

You can try avoiding re-natal stuff, by doing lein prod-build this will compile ā€˜fatā€™ index.ios.js and index.android.js which you should be able to just run

drapanjanas23:01:58

but for developing luno with figwheel try using [email protected].

drapanjanas23:01:24

One more thing you have to do to make it run now is in registerRunnable call you need to change ā€œLunoā€ to ā€œlunoā€. Author knows about this so it will be fixed soon.

drapanjanas23:01:11

At least I had to do it to make it run and it did simple_smile

jurgen_photek23:01:34

ok I'll try that. just to be sure i just created a brand new project via re-natal init, did lein prod-build, which worked, then running in xcode get the same react packager error as above.. re-natal is version 0.2.19. I'll try other versions and if I find anything helpful I'll let you know. despite this... great effort on re-natal. looking fwd to developing with it. gotta get some sleep now

wei23:01:59

re: Frappe, as an alternative you could just bind something to execute the shell command adb shell input keyevent 82