Fork me on GitHub
#cljsrn
<
2016-02-01
>
podviaznikov05:02:11

hey everyone, I’m using natal and can run my app in simulator using natal launch. Now I tried to open project in XCode because I wanted to run in on a device. I selected my device and clicked run/build button. But I’m getting following error

ld: library not found for -lAmbly
clang: error: linker command failed with exit code 1 (use -v to see invocation)
. Anyone had the same issue?

mj_langford05:02:32

You opening the workspace or the prj?

podviaznikov05:02:08

yeah, I think I opened project. After I did natal xcode it opened workspace and everything worked. Thanks!

mfikes16:02:10

@podviaznikov: Glad you sorted that. We had that occur for a while and it was presumably fixed, but to be honest the problem was a bit subtle. https://github.com/omcljs/ambly/issues/116

mfikes16:02:21

I guess Natal is not even using that version of Ambly

seantempesta18:02:55

What root element should be specified when running AppRegistry.registerComponent? In react web you specify a dom element, but what do you do for react native?

artemyarulin18:02:35

don’t remember, but there is parameter that will be passed to your generator function, and it may have rootTag property which would be equal to 1 for the first RCTRootView, 2 for the second, etc.

artemyarulin18:02:03

well, actually if you are using registerComponent then there is nothing to specify. You just do something like:

(def root-component (core/class {:render #(components/text {:onPress (fn[](start-figwheel))} "Start figwheel”)
(core/register-component app-name (constantly root-component)))))
but in case you don’t have RN component, then you have to call registerRunnable smth like:
(.registerRunnable js/AppRegistry app-name #(mount (aget % "rootTag"))))
where mount is a function specific for your framework

seantempesta18:02:42

So, om-next doesn’t want to mount a component until it ensures the data is available for it. So what are you supposed to put there?

artemyarulin18:02:21

not sure that I follow, do you have an example or gist?

seantempesta18:02:49

hmm, give me a second and I’ll create one

seantempesta18:02:21

So, that works because I’m passing a react component. But that’s not what I’m supposed to be doing for om-next.

artemyarulin18:02:58

I should be something like that

(defn main []
-  (.registerComponent app-registry "SimpleExampleApp"
-                      #(om/factory MainView)))
+  (.registerRunnable app-registry "SimpleExampleApp"
+                      #(om/add-root! reconciler
+                               MainView
+                               (aget % "rootTag”))

artemyarulin18:02:43

hm, actually it may work with registerComponent if you wrap it with om/factory… but apparently it doesn’t for you

seantempesta18:02:45

omg, thank you!

seantempesta18:02:17

How do you trigger om-next to re-render? For live javascript reloading.

artemyarulin19:02:29

I don’t - figwheel does it for me, it just reloads the namespace and this code reruns again

artemyarulin19:02:52

well, there is a force-rerender or something like that in om-next, don’t remember unfortunately

drapanjanas19:02:07

One thing I noticed when you mount your component on rootTag, warnings does not appear anymore on screen

artemyarulin19:02:04

@drapanjanas: Hm, really? What do you use then? Another number?

drapanjanas19:02:19

when using figwheel I preseve original component (which first shows splash) and load all js files in componentDidMount function. So that I do need to mount on 1

drapanjanas19:02:33

its a bit not that streight forward but works with warnings

drapanjanas19:02:47

do not know if that is the only way to show warnings, but that what I have found

artemyarulin19:02:25

hm, thanks - I’ll check my code and test this

artemyarulin19:02:50

yep, usually I rely on NSLog inside XCode, this one is much better. Interesting why it doesn’t work after moun to the rootTag

drapanjanas20:02:29

I am just guessing that in dev mode when you register your component with registerComponent your component is somehow wrapped by something else to show warinngs. And when you remount rootTag you loose that wrapper

pesterhazy20:02:31

good god, react-native is full of bugs

artemyarulin20:02:52

>good god, react-native is full of bugs you are new to RN, aren’t you? 😄

pesterhazy20:02:37

plus I'm not accustomed to the tolerance for crazy issues in the javascript community

pesterhazy20:02:04

also is npm down? I'm getting ETIMEDOUTs 😞

pesterhazy20:02:21

I'm working with react-native 0.19 now (upgrading from 0.14), and it looks like the latest version of the packager cannot cope with Google Closure compiled bundles anymore (it freezes in the "minify" step

artemyarulin20:02:42

do you use re-natal or any other helper?

pesterhazy21:02:50

boot-react-native

pesterhazy21:02:37

@mjmeintjes: have you managed to build "offline bundles" with recent versions of the react-native packager yet? I'm having trouble getting it to work.

pesterhazy22:02:30

I confess I don't have a clue how the RN packager works

mjmeintjes22:02:26

@pesterhazy: No, haven't really tried but I'll check it out.

pesterhazy22:02:55

it's proving more difficult than I thought

pesterhazy22:02:21

if I use optimizations :none, it doesn't find the depdendencies

pesterhazy22:02:00

if I use optimizations :whitespace, it misinterprets goog.require as RNpackager's require and fails

pesterhazy22:02:42

if I use optimizations :advanced, I see Unhandled JS Exception: Assert failed: c

pesterhazy22:02:51

which is not very informative simple_smile

pesterhazy22:02:52

as for :whitespace, apparently RN's packager uses a simple regex to find everything that looks like require(...), and interprets that as a dependency

pesterhazy22:02:07

... including goog.require!

pesterhazy22:02:06

I'd be curious what you think

mjmeintjes23:02:30

Yes, RN's packager uses a lot of regex's to parse dependencies. However, I've definitely been able to build the bundle before. Just checking - are you using boot-react-native, and if so, have you disabled boot-react-native for your deployment builds?

pesterhazy23:02:52

I'm calling the packager manager for now like so:

node node_modules/react-native/local-cli/cli.js bundle --platform ios --dev true --entry-file dist/main.js --bundle-output main.jsbundle --verbose

mjmeintjes23:02:30

Does it work when you aren't creating the bundle - i.e. just running boot dist, then react-native start and then running the app?

pesterhazy23:02:42

boot dev --platform ios brings up the app in the simulator

pesterhazy23:02:58

ah wait, you mean something else...

pesterhazy23:02:48

you mean to use

pesterhazy23:02:37

with optimizations: whitespace, I get

{"message":"Unable to resolve module goog.debug.Error from /Users/pe/fy/boot-react-native/example/app/dist/main.js: Invalid directory /Users/node_modules/goog.debug.Error","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]}

pesterhazy23:02:18

again the same problem (the reference to /Users/node_modules/goog.debug.Error is the packager's oblique way of saying it can't find your mdoule)

pesterhazy23:02:46

with optimizations :advanced, I get

2016-02-02 00:26:12.662 [warn][tid:com.facebook.React.JavaScript] Assert failed: c
2016-02-02 00:26:12.668 [error][tid:com.facebook.React.RCTExceptionsManagerQueue] Unhandled JS Exception: Assert failed: c
2016-02-02 00:26:12.906 [warn][tid:com.facebook.React.JavaScript] Module AppRegistry is not a registered callable module.
2016-02-02 00:26:12.907 [error][tid:com.facebook.React.RCTExceptionsManagerQueue] Unhandled JS Exception: Module AppRegistry is not a registered callable module.

pesterhazy23:02:09

maybe I'm missing the necessary externs?

pesterhazy23:02:34

I'm trying optimizations :simple now - grasping at straws

pesterhazy23:02:00

now I'm getting Module AppRegistry is not a registered callable module

mjmeintjes23:02:50

For simplicity's sake I would focus on getting optimizations :whitespace working first before trying :advanced. I've reproduced the problem on my PC. Will play around and let you know.

pesterhazy23:02:50

yup I agree that anything but :whitespace is a path to madness when you need to identify errors