Fork me on GitHub
#cljsrn
<
2016-08-05
>
seantempesta09:08:25

So advanced compilation doesn’t work with react-native? Anyone know the reason and if it’s fixable?

artemyarulin09:08:10

@seantempesta: It works, did you add rn externs?

seantempesta09:08:07

You mean requiring other react-native libraries?

artemyarulin09:08:20

or any other way how to obtain externs for RN

artemyarulin09:08:35

and then externs for other libs yeah 🙂

seantempesta09:08:00

oh…wow, that sounds like a lot of work. I’m using a lot of libraries. So it won’t work without the externs?

seantempesta09:08:31

It looks like the js/require statements are still in the output. Shouldn’t the react native packager work normally?

artemyarulin09:08:42

well, this is a way how advanced compilation works - without externs file Google Closure rename a lot of important staff

seantempesta09:08:03

bummer. I saw a huge reduction in code size.

artemyarulin09:08:03

indeed, or another way you can always communicate with external libs not like jQuery.addClass but jQuery[‘addClass’] so the name would be the same. But it’s ugly as well 🙂

artemyarulin09:08:58

I guess you should check other minifiers which are not that aggressive, although the result wouldn’t be that good

seantempesta09:08:06

nah, it’s okay

seantempesta09:08:29

I’ll worry about this kind of stuff when my app is actually making money

artemyarulin09:08:57

what are you building if I may ask?

seantempesta09:08:46

Contact management application for non-profits (specifically after school programs). Maybe targeting schools too (attendance tracking, parental communication, etc.)

seantempesta09:08:23

iOS and Android and web

artemyarulin09:08:45

oh nice - have you found a way how to share code between RN and web?

artemyarulin09:08:57

I’ve heard about react-native-web and other projects

seantempesta09:08:25

Well, the majority of my code is in re-frame subscriptions, so that should transfer well.

seantempesta09:08:35

I haven’t thought about react-native-web yet

artemyarulin09:08:57

Cool, do you use clojure on backend as well?

seantempesta09:08:10

eventually I’d like to, but I’m using Firebase at the moment

pesterhazy09:08:38

I think advanced compilation is not necessarily worth the effort

artemyarulin09:08:40

oh yeah, heard good things about it. But yeah - I really like that I can use Clojure almost everywhere nowadays

pesterhazy09:08:45

on react native

pesterhazy09:08:56

because bundle size doesn't matter as much as on the web

seantempesta09:08:02

It already feels like a monumental amount of work to develop for 3 platforms without tackling authentication, authorization, secure websocket connections, etc..

artemyarulin09:08:35

@pesterhazy: There are still to cases for that: 1) If you want to do hot deploys and do it daily or more often (like we used to do in web) 2) GC is best obfuscator - not a big deal for certain cases, but it drives me crazy a bit that somebody can unpack bundle and recreate the app in 10 minutes 🙂

pesterhazy09:08:57

both valid points

pesterhazy09:08:29

plus :advanced gives you speed benefits too

artemyarulin09:08:50

you mean JS performance? Haven’t heard about it

pesterhazy09:08:12

well I assumed that given a whole view would enable optimizations like inlining code

pesterhazy09:08:46

e.g. disable code due to goog.DEBUG=false

pesterhazy09:08:06

but I think it's not a monumental gain

artemyarulin09:08:19

but in general yeah - it’s time consuming to create externs for different libs. So like @seantempesta said - only when you get some money from app 🙂

pesterhazy09:08:43

also, create externs and publish them at cljsjs, for everyone's benefit 🙂

artemyarulin09:08:30

yeah, I was thinking about it for rn-externs, but was too lazy for that, shame on me 🙂

tiensonqin12:08:22

Anyone can send me an product hunt invite? Finally get app to beta test, thought maybe product hunt and hacker news are good places. Suggestions welcome!

tiensonqin13:08:54

By the way, I've made a website, https://www.lymchat.com/

tiensonqin13:08:29

@pesterhazy: Thanks, It took me nearly 2 months to build this, actually it's my first app, 😄

pesterhazy13:08:15

is it cljrn based?

tiensonqin13:08:46

Yes, backend is clojure, web and app both re-frame

tiensonqin13:08:18

I use realm.js in app, It really saves me

tiensonqin13:08:32

Even with realm, I still really want datomic/datascript for mobile.

seantempesta13:08:58

I thought about using realm, but ended up using datascript. It’s been a love/hate relationship. 🙂

seantempesta13:08:03

hey @pesterhazy. How do you require images in boot-react-native? The react native packager can’t seem to find them.

tiensonqin13:08:09

I have to store contacts and chat history in disk, so datascript along not works for me.

pesterhazy13:08:27

that'd be a good next post for my blog series

pesterhazy13:08:25

ok so I use this macro to point to the file:

(defmacro static-img [filename]
  `(js/require ~(str "../../../app/imgs/" filename)))

pesterhazy13:08:54

second, for reloading I always use defonced vars for images so the packager doesn't get confused

pesterhazy13:08:26

third, you need to make sure the imgs folder is in packager root (I think!)

seantempesta13:08:52

cool, that works.

coyotespike13:08:30

well done @tiensonqin! The second app goes so much faster 🙂

tiensonqin13:08:47

It's both cljs and rn communities' merit, especially the big @dnolen and @mfikes. Really thanks!

pesterhazy13:08:56

@tiensonqin: why not do blog post about our experience?

pesterhazy13:08:03

I'd be interested

tiensonqin13:08:19

Actually I'm writing it now!

tiensonqin13:08:38

I'm chinese, and now it's 9:42pm here, Maybe tomorrow I can finish it. Not good at writing in english, will try my best.

pesterhazy13:08:33

I've noticed there's a lot of interest in RN from china

tiensonqin13:08:34

@pesterhazy: All i can say on my experience is: Clojurescript rocks and npm sucks!

pesterhazy13:08:50

a lot of npm RN packages are built by people with Chinese names, at least

tiensonqin13:08:11

Yeah, a lot guys around me are interested in RN, clojure, erlang

pesterhazy13:08:41

@tiensonqin: that's awesome to see people interested in those technologies

tiensonqin13:08:16

Since there are a lot companies can't find native developers in china.

boorad13:08:38

@pesterhazy: with logging all rolled together in BRN, how do I get a pretty-print of an object with console.log?

pesterhazy13:08:13

if people are interested in React and RN, I think it shows they have a good sense of what's important in computing

pesterhazy13:08:29

@boorad: what are you using to show the log?

boorad13:08:58

rn log-ios, probably

pesterhazy13:08:01

actually we're looking for an Android freelancer at the moment, and it's not easy find someone

boorad13:08:02

I’m looking

boorad13:08:25

does —dev true do anything?

pesterhazy13:08:36

in which command?

pesterhazy13:08:54

yeah react-native log-ios is a good start. What's your issue with it?

boorad13:08:56

somewhere in BRN, maybe the packager

boorad13:08:09

I get only one line of the complex object output

boorad13:08:14

truncates the rest

pesterhazy13:08:20

yeah that's a bug in an older version

boorad13:08:20

and chrome dev tools don’t work

pesterhazy13:08:44

so you shouldn't use boot print-ios-log anymore

pesterhazy13:08:55

instead, use react-native log-ios directly

pesterhazy13:08:06

in a separate terminal window

pesterhazy13:08:10

that'll give you the complete output

tiensonqin13:08:12

@pesterhazy: Hope you find the right person.

boorad13:08:32

but I’m using BRN to have only one terminal window 🙂

boorad13:08:39

got it, tho… thanks

pesterhazy13:08:56

yeah I found that it's pretty confusing to ahve all the output intermingled

boorad13:08:16

I don’t mind (yet)

pesterhazy13:08:41

to remove all output not related to my app

pesterhazy13:08:53

it's necessary because the iOS simulator is incredibly chatty

seantempesta13:08:42

“chatty” is a kind way of putting it

boorad14:08:01

you still have the old call...

boorad14:08:12

you must just ignore that window

boorad14:08:01

boom, got me some nice output now

pesterhazy14:08:47

@boorad: is latest master working for you? I'm thinking of making a clojars release of 0.3.0 soon

boorad14:08:02

haven’t checked

boorad14:08:23

I have most of our patches in master, but was just about to look at any changes you may have made

boorad14:08:27

or are you talking about matt’s master?

pesterhazy14:08:34

matt's master, yes -- I've force-pushed develop to replace master

boorad14:08:44

I’m tearing things apart, so I’ll try this. It doesn’t have #46 in it, does it.

pesterhazy14:08:00

no, that's gone

pesterhazy14:08:37

here's my blog post on how to get things working with 0.3: http://presumably.de/boot-react-native.html

pesterhazy14:08:51

also check the new troubleshooting section 🙂

boorad14:08:08

nice, I think I saw a draft of this in your commit msgs

boorad14:08:51

I was seeing weird things with 0.30 and just grasping at straws… so I am on 1.9.89 of cljs. Like I said, tearing things apart.

boorad14:08:11

I’ll switch to this 0.3 snapshot

pesterhazy14:08:20

cool. remember to boot inst to install it into your maven repo

pesterhazy14:08:29

does the cljs version make a difference?

boorad14:08:46

huh, I’ve been doing boot build-jar to install locally

boorad14:08:32

not sure yet on cljs version - so many errors from RN version mismatches and release cycle

boorad14:08:38

very frustrating 😬

pesterhazy14:08:34

yeah, I've been working on the RN update of our app for a whole week now

pesterhazy14:08:00

all the deps need to be updated because of the react-native/react-dom split

pesterhazy14:08:36

ah maybe build-jar works too, who knows 🙂

pesterhazy14:08:45

@seantempesta: now I'm seeing "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory" as well with latest RN packager

seantempesta14:08:02

I almost fell out of my chair when the upgrade from RN 0.25 —> 0.30 "just worked"

seantempesta14:08:56

@pesterhazy: well, you could try my patch/hack?

seantempesta14:08:30

Has anyone tried using react-native-navigation? I’m currently living with an iOS developer and he’s been rolling his eyes at the non-native transition stutters in my app. https://github.com/wix/react-native-navigation/

seantempesta14:08:04

I’m not sure that’s the best reason to replace navigation, but this solution seems promising.

boorad14:08:14

@seantempesta: I’ve been trying to use your RNRF - should I abandon?

pesterhazy14:08:41

the whole situation is so confusing

seantempesta14:08:00

hmm, that’s your call. I’ve pretty much got my whole app running on it.

pesterhazy14:08:10

1. NavigationIOS

boorad14:08:14

cool, I’m fine going with it

pesterhazy14:08:19

2. Navigator (pure js)

seantempesta14:08:20

it certainly works, but it helps if you never look at that codebase. it’s a shit show.

pesterhazy14:08:43

3. Navigation

boorad14:08:54

too late… I can’t unsee it.

pesterhazy14:08:13

NavigationIOS works ok (and uses native transitions) but sort of (?) deprecated

seantempesta14:08:00

yeah, I just loaded up the example app in react-native-navigation and it’s buttery smooth

seantempesta14:08:19

My iOS developer friend just said, “yeah, use that"

seantempesta14:08:37

I’m trying to get it running on the Android simulator so I can see what it looks like there

pesterhazy14:08:38

@seantempesta: how's the api of that?

pesterhazy14:08:56

is it a bit less ... cumbersome than the stock Navigator?

seantempesta14:08:20

It seems similar to most. You’ve got global access to some things, and others you’ve got to deal with navigator objects passed through props.

seantempesta14:08:51

I’m trying to think of a way to abstract all that crap away, but it’s not a functional solution at all so it’s going to be messy

seantempesta14:08:09

but that company, Wix, seems dedicated to building a truly multiplatform native solution. I’ve been watching their issues for a while and they are super responsive. Might be safer to wait for the version 2.0, but it actually seems pretty usable as is as long as you aren’t too picky about some styling.

pesterhazy14:08:16

I'm looking to replace my use of navigatorios soon

pesterhazy14:08:23

our code is icky

seantempesta14:08:48

I can imagine. When I saw Facebook was deprecating it I didn’t even try it out.

savelichalex14:08:35

as far as I know @madvas create some wrapper around react-native-navigation

pesterhazy14:08:51

that'd be interesting

seantempesta14:08:16

oh yeah? I’d love to not start from zero

pesterhazy14:08:36

it'd be great to build a library of components, already pre-wrapped for cljs

pesterhazy14:08:48

with usage examples 🙂

seantempesta14:08:53

Okay, I just got the android emulator working and it’s not running well

seantempesta14:08:06

Like many options in the same example that works great on iOS just crash

seantempesta14:08:24

plus the tabs are on the bottom, which isn’t standard for Android right?

boorad14:08:45

material design tabs are usually at the top

seantempesta14:08:19

yeah, okay, since I need to support Android I think I’ll let this bake a little while longer

madvas15:08:33

You can see some react-native-navigation here https://github.com/madvas/catlantis . May be a bit outdated though

pesterhazy15:08:55

holy crap those are long lines, savelichalex

seantempesta15:08:53

@pesterhazy: did that gc hack fix your packaging woes?

savelichalex15:08:58

smth bad happened with my code 🙂

savelichalex15:08:51

main idea is control navigation by app db in re-frame terms

seantempesta15:08:08

yeah, I like it

pesterhazy15:08:38

@seantempesta: I tried setting goog.DEBUG to false first, didn't help

pesterhazy15:08:25

trying your hack now

pesterhazy15:08:23

@seantempesta: does the command line also affect the worker processes?

pesterhazy15:08:50

I guess GC is more difficult if it runs across multiple processes

seantempesta15:08:21

That hack works for all of the launched processes

seantempesta15:08:03

which might be redundant. I don’t really know much about node. 🙂

pesterhazy15:08:15

@seantempesta: holy moly, that worked

seantempesta15:08:24

kind of amazing, right?

seantempesta15:08:45

also kind of sad

pesterhazy15:08:50

thinking about it

pesterhazy15:08:04

maybe you can also just make it only use a single worker

seantempesta15:08:07

personally, I’m just happy it works

pesterhazy15:08:43

because evidently the issue is to do GC when you don't have a shared view of the system, effectively fragmenting the available memory

pesterhazy15:08:34

it also seems to cache intermediate output files, because if I re-run it it works

pesterhazy15:08:34

@seantempesta: I tried it, and just adding --max_old_space_size=4096 also does the job for me

seantempesta15:08:08

yeah, that worked with me for a while, and then I added another require and then that stopped working too

pesterhazy15:08:48

it's definitely a step in the right direction

pesterhazy15:08:49

try setting goog.DEBUG too, may help

pesterhazy16:08:59

what's a good android phone to get nowadays, for testing?

boorad16:08:35

get a OnePlus model