Fork me on GitHub
#cljsrn
<
2016-08-13
>
seantempesta09:08:42

Anyone out there experiencing UI jank due to computations that are occurring on the main thread? I couldn’t take it anymore, so I moved everything over to a worker thread and I’m quite pleased with the result. I’m sharing my code as a library in case anyone else finds it useful. The library is using re-frame and react-native-workers. Let me know what you think! https://github.com/seantempesta/cljsrn-re-frame-workers

artemyarulin12:08:01

@seantempesta: Can you elaborate more about the problem? I thought ReactNative itself does everything on background thread

seantempesta12:08:26

Native things render on the background thread. Navigation, animations, and list views are some of the things I’ve had problems with.

seantempesta12:08:48

(those aren’t native and run in the javascript thread)

seantempesta12:08:24

I started running into this problem on some of my views that had a lot of aggregate calculations. One change to the underlying data set and most things needed to be recalculated. Having the UI freeze every time that happens isn’t such a great UI experience.

seantempesta12:08:26

I make some animated gifs that show it happening. You can also just run the example to see it for yourself. https://github.com/seantempesta/cljsrn-re-frame-workers/tree/master/examples/worker-test

artemyarulin12:08:01

ah, got it - you have heavy computation and it affects the UI. I’ll check the code, thank you