Fork me on GitHub
#cljsrn
<
2016-04-11
>
anthonymittaz08:04:49

hey, currently playing with re-natal, anyone else is getting this overwriting an event-handler for etc… message

anthonymittaz08:04:53

I remember last time I played with it, probably a couple of weeks ago I could just go modify (def app-db {:greeting "Hello Clojure in iOS and Android!”}), save and would see it update on the iOS simulator, not the case anymore

anthonymittaz08:04:24

If I would go change press me to something else and save it would then update the button title in the iOS simulator

anthonymittaz09:04:16

i guess it’s more something to do with re-frame simple_smile

drapanjanas09:04:32

@anthonymittaz: I think the warning about overwriting is coming from re-frame when handlers namespace is reloaded. The app-db you mentioned is only used to initialized app db managed by re-frame so if you change that after app state is initialized nothing happens because the real atom is slill same. You have to publish events to change the app state after it is initialized. So this is expected behavior I think.

drapanjanas09:04:11

Maybe before you tried with Om.Next? There you can redefine the atom value by reloading I guess

anthonymittaz09:04:55

Thanks it makes sense. Don't remember if I used reagent or else, all good 😎

misha10:04:25

good day, gentlemen Some data on DataScript performing on iphone 5 device (≠ simulator, ≠ 5s, ≠ 5se): Following is a log sample, where each row represents a DS d/transact! transaction of 1–5 datoms (creating entities/linking them/setting attributes). Running application with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF

db=> (count (d/datoms @DB :avet))
92

2016-04-11 13:32:56.836
2016-04-11 13:32:56.879
2016-04-11 13:32:56.890
2016-04-11 13:32:56.901
2016-04-11 13:32:56.909
2016-04-11 13:32:56.917
2016-04-11 13:32:56.927
2016-04-11 13:32:56.941
2016-04-11 13:32:56.949
2016-04-11 13:32:56.958
2016-04-11 13:32:56.966
2016-04-11 13:32:56.975
2016-04-11 13:32:56.987
2016-04-11 13:32:56.996
2016-04-11 13:32:57.007
2016-04-11 13:32:57.014
2016-04-11 13:32:57.020
2016-04-11 13:32:57.028
2016-04-11 13:32:57.035
db=> (count (d/datoms @DB :avet))
6886

2016-04-10 18:23:29.655
2016-04-10 18:23:29.763
2016-04-10 18:23:29.867
2016-04-10 18:23:29.972
2016-04-10 18:23:30.077
2016-04-10 18:23:30.189
2016-04-10 18:23:30.293
2016-04-10 18:23:30.394
2016-04-10 18:23:30.496
2016-04-10 18:23:30.595
2016-04-10 18:23:30.693
2016-04-10 18:23:30.794
2016-04-10 18:23:30.901

misha13:04:21

is it possible to send off some js execution to a separate thread in RN? swap!ing an atom visible in the main thread would be sweet simple_smile

mj_langford15:04:16

I only know how to do that via Native Modules

mj_langford15:04:47

Here is a document on Native Modules that also talks about backgrounding stuff with dispatch_async on iOS https://facebook.github.io/react-native/docs/native-modules-ios.html

adamfrey15:04:02

I have a minimal repo for the problem I’m seeing with re-natal and om.next: https://github.com/AdamFrey/re-natal-om-next-problem

adamfrey15:04:58

@drapanjanas: has anyone mentioned this happening? variables from other namespaces all being bound to nil after a defui call?

adamfrey15:04:21

Or anyone else who is using re-natal and om.next together? This is a really unavoidable problem so I’m baffled that I’m seeing it. I’m using Genymotion by the way

adamfrey15:04:04

so the same code in the ios simulator throws an Evaluation Error, whereas the Android simulator shows no error, or swallows it. That’s my first clue I guess

adamfrey15:04:57

it turns out that the problem I had was the js/React was not being set before being used. It was easy to find in the iOS simulator, but because the Android emulator swallowed the error I didn’t realize that’s what I was running into

drapanjanas16:04:45

@adamfrey: glad you have sorted that out. To be honest I have experimented with Om.Next just enough to add the working template to re-natal. So not much of an expert with that simple_smile

stepugnetti16:04:32

@vikeri: Coming back to my question about react-native-router-flux, since I could not find a way to use it in Reagent, how did you approach using NavigationExperimental? Did you import all the relevant components, or did you just drew inspiration to re-implement the basic features with re-frame? Following the docs on NavigationExperimental it looks like you have to use specific Js patterns that do not translate immediately into Reagent, right?

seantempesta16:04:54

@stepugnetti: I have it working in Reagent. And the 3.x branch is using NavigationExperimental.

stepugnetti16:04:40

@seantempesta: Great! I’d love to see the details, or at least some hints. Have you any link to point me to? I succeeded in importing the components in Reagent, but then I cannot compose them into new components, or my app crashes...

seantempesta16:04:44

Hmm, I don’t have a complete working standalone version of the code, but I pulled out the relevant parts from my app in a gist for you https://gist.github.com/seantempesta/408def04c6371564f8f757b4fc3784cc

seantempesta16:04:37

you’re welcome!

seantempesta16:04:27

oh, all the defstate and deref’ing is because I’m using mount for system management. Highly recommended btw. https://github.com/tolitius/mount

stepugnetti16:04:27

Thanks for this link as well, I need give it a look, too.

seantempesta17:04:14

Yeah, it’s really awesome. I’ve moved all react requires over to it so you only pay the cost of loading libraries when you actually use them. Really sped up my application start times.

seantempesta17:04:00

Not to mention not having to think about dependency ordering. I put my datascript dbs on there too and I don’t even have to think about initialization anymore.

stepugnetti17:04:37

Cool! Coming back to your gist, at a first glance it seems that what you have done is what was working for me, too. I had big troubles, though, when I tried to redefine the route component so as to change the key names in the option map, like:

(def route* (adapt-react-class (.-Scene js/ReactNativeRouterFlux)))
(defn route
  [opts & children]
  (into [route* (some-changes-to opts)] children]))
Apparently Reagent was no longer transforming it correctly when as-element is called on it, and as a result Router throws an error at runtime… Have you ever used imported components like this?

seantempesta17:04:31

Hmm. I’m not sure I’m following you. Why are you changing the key names in the option map?

stepugnetti17:04:33

There is a good reason. My code should target both a mobile and a browser: the core code should be the same, just some symbols should have different definitions for the two platforms. Now, I found a nice component ReactRouter, that kind-of works with Reagent. So now I would like to have the same api for the mobile, and react-nativroutefluxwould be the perfect match. They have different names for some properties though: for instance. the keyproperty becomes pathon the other side.

seantempesta17:04:01

Well, you can also just declare you scenes dynamically. Maybe just write a function to do it at app start? [from react-native-router-flux]:

const scenes = Actions.create(
            <Scene key="root">
                <Scene key="login" component={Login} title="Login"/>
                <Scene key="register" component={Register} title="Register"/>
                <Scene key="home" component={Home}/>
            </Scene>
);
///
class App extends React.Component {
    render() {
        return <Router scenes={scenes}/>
    }
}

stepugnetti17:04:49

I read this in react-native-router-flux Readme, but I’m not sure this can help with my problem. I still need to compose Router, or Scene, and this will make the app crash...

seantempesta18:04:29

Not sure I’m following…again…sorry. You’re saying that if you build your routes at runtime it will cause the app to crash? Why?

andre.richards20:04:28

Hi, can anyone point to sample Reagent code that makes use of the Navigator on Android? I have used the facebook Movies project as an example (https://github.com/facebook/react-native/blob/master/Examples/Movies/MoviesApp.android.js) but I cannot get it to work... There are no errors, but the contents I add to Navigator never shows. The Navigator fills the screen (I have confirmed by setting its background-color)

andre.richards20:04:20

I have tried various combinations of [view], [scroll-view] as children, specified specific heights, flex, etc.