Fork me on GitHub
#cljsrn
<
2017-07-03
>
gphilipp07:07:15

@paulbutcher in fact they can be shared, I just have a one-liner in both ios/core.cljs and android/core.cljs: shared.views/init where the shared.viewsnamespace lives under src.

paulbutcher09:07:49

Thanks @gphilipp - much appreciated.

pesterhazy09:07:06

Just spent an hour of my life adding a launch image. Thanks XCode

gphilipp09:07:01

@pesterhazy I’ll be interested, can you describe how ?

pesterhazy09:07:37

I still don't understand the difference between Launch Image and Launch Screen

gphilipp09:07:48

@mfikes @pesterhazy @raspasov I’ve done some experiments with using react-native-externs and changing the way to access props and both failed when using :advanced mode. My results are here : https://github.com/gphilipp/future-app/blob/master/README.md, the logs are on their respective branch.

gphilipp09:07:51

@pesterhazy Good catch, I fixed it. But now I have a different error:

 is not a function. (In '("FutureApp", function () {
            if (!t(tp)) throw Error("Assert failed: c");return Tl(tp) ? tp : hm(tp);
        })', '' is undefined)
2017-07-03 11:48:04.698 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception:  is not a function. (In '("FutureApp", function () {
            if (!t(tp)) throw Error("Assert failed: c");return Tl(tp) ? tp : hm(tp);
        })', '' is undefined)

gphilipp09:07:47

Seems like the register fn

gphilipp09:07:05

In index.ios.js: return ("FutureApp",function(){if(!t(tp))throw Error("Assert failed: c");return Tl(tp)?tp:hm(tp)})})();

gphilipp09:07:06

probably this line (.registerComponent app-registry "FutureApp" #(r/reactify-component app-root))

gphilipp09:07:20

what’s wrong with it ? @pesterhazy

pesterhazy09:07:30

same problem

pesterhazy09:07:50

try

((gobj/get app-registry "registerComponent") "FutureApp" #(r/reactify-component app-root))

pesterhazy09:07:24

not saying this is pretty 🙂

pesterhazy09:07:45

(.call (gobj/get app-registry "registerComponent") app-registry "FutureApp" #(r/reactify-component app-root))

pesterhazy09:07:57

that's the one 🙂

gphilipp10:07:21

Hurray, it works

pesterhazy10:07:05

that said, @mfikes is probably right that the externs file is the more straightforward solution here 🙂

pesterhazy10:07:28

I think it's useful to go through the motions of using gobj/get to fix theses issues, just to understand how Closure's minifier works

gphilipp10:07:36

Yeah, i’m onto the react-native-extersn branch now 😄 I think I have a lead, ReactNative.TouchableHighlight = {} is missing from the react.native.ext.jsfile in react-native-externs-0.0.1-SNAPSHOT.jar /cc @artemyarulin

gphilipp10:07:25

@pesterhazy I fully agree. I have a much better understanding now.

pesterhazy10:07:44

please consider making a PR to reagent for that assert

pesterhazy10:07:16

it bites every react-native user. IMO it should come with a proper error string (second arg to assert)

pesterhazy10:07:32

the other thing is that apparently the stack traces are missing from your logs

pesterhazy10:07:41

that's an issue that I've seen many times before

gphilipp10:07:19

There’s another version, which includes it : 0.0.2

pesterhazy10:07:24

I think the stack trace is available (if garbled), but it gets swallowed somehhow

gphilipp10:07:10

And now, the react-native-branch is working properly :thumbsup:

gphilipp10:07:53

Now, I’m onto the memory issue

pesterhazy10:07:08

haha, you're being bitten by all the classics

pesterhazy10:07:38

I'd try setting the available memory for node first

gphilipp10:07:06

My app is composed of maybe 10 screens, I use a few libs (react-native-vector-icons, react-native-swiper, react-navigation, react-native-datepicker), and since I upgraded from react-native:0.44.2 to react-native 0.45.1 I can’t build my app anymore in the production profile with :simple. It fails with an out of memory error. I had of course updated the NODE_BINARY environment variable in project.pbxproj like this node --max_old_space_size=8192.

pesterhazy10:07:38

you can try my DEV__ hack (if you scroll up)

gphilipp10:07:04

yeah I know, but I want first to try to fix the problem at the root 🙂

gphilipp10:07:54

I’m bothered that everything builds fine with RN 0.44 but goes haywire with RN 0.45

gphilipp10:07:03

Something which is weird is that when trying to use the GC trick https://github.com/facebook/react-native/issues/5196#issuecomment-237549879 from @seantempesta, I see Garbage collection is not exposed in the build log even when I adjust the NODE_BINARY variable to read node --expose-gc --max_old_space_size=8192.

pesterhazy11:07:18

I wish we could solve this once and for all

gphilipp11:07:23

that’s what I want

pesterhazy11:07:29

oh you may also want to explore disabling optimizations in .babelrc

pesterhazy11:07:45

not sure if that's even relevant for react-native bundle but worth a try

gphilipp12:07:49

Ok, I’ve some news. I had tried to use advanced compilation in my big project, but I still had the dreaded Assert failed: c error. I didn’t want to go through all libraries I use and declare externs. Then I remembered that ClojureScript now can infer externs since 1.9.456 (https://clojurescript.org/guides/externs). So I just added :infer-externs true in the production profile in project.clj just above :optimizations :advanced and now it works perfectly, no more memory issue. So I didn’t fix the memory issue, I just avoided it. thanks @raspasov @mfikes @pesterhazy

pesterhazy12:07:31

Nice! Totally forgot about that

gphilipp12:07:09

@drapanjanas maybe this could be added in the next version of re-natal ?

drapanjanas12:07:48

@gphilipp yeah, its easy to change template in re-natal :) if it works - fine with me. I'm a bit busy with work lately, there are pending changes to release already.. but i can look into this next

gphilipp12:07:40

Oddly, even if enabling extern inference, I still have to use the react-native-externs library otherwise I get this error

[error][tid:com.facebook.React.JavaScript] undefined is not a constructor (evaluating 'new d9.ListView.wh(Rx(new Cr(null,1,[K1,function(n,t){return XE.b(n,t)}],null)))')

gphilipp14:07:13

@pesterhazy All right, I think I’ve nailed it.

gphilipp15:07:43

@pesterhazy since RN 0.45 you now have to set an additional flag to the node process: --max_new_space_size 512. I’m currently doing some time measurements with various values of max_new_space_size and max_old_space_size. I’ll post them here, and on my repo (https://github.com/gphilipp/react-native-with-clojurescript/blob/master/README.md)

pesterhazy15:07:06

thanks, that'll help a lot

pesterhazy15:07:10

how did you discover this?

gphilipp15:07:43

I had found about this option a few days ago when reading a few blogs here and there but all of them stated that it had no meaningful effects compared to the max_old_space_size option. I should have known better, the devil is in the details 😈

gphilipp15:07:54

I am also pretty sure the GC triggering trick doesn’t have much effect.

gphilipp15:07:07

@pesterhazy I’ve discovered neat stuff. You don’t even need to set max_old_space_size

gphilipp15:07:26

no it’s not

gphilipp15:07:35

I think I made a mistake.

gphilipp15:07:28

I didn’t notice but max_new_space_size has been removed in node 8 https://github.com/JaraLowell/OgarServ/issues/114#issue-141618013

gphilipp15:07:24

So, all my builds succeed but they have this line in the logs : node: bad option: --max_new_space_size=2048 in the logs. I think the simulator may have happily launched the last well build version (which used :advanced and :`infer-externs true`).

gphilipp15:07:30

back to digging 😩

pesterhazy16:07:12

yeah that's happened to me before

pesterhazy16:07:37

very annoying if you think you're making progress but really you're just seeing a shadow