Fork me on GitHub
#cljsrn
<
2016-10-26
>
seantempesta03:10:17

Anyone else having laggy text-input data entry using reagent? I’m not even doing a roundtrip to re-frame and I’m getting errors like this:

YellowBox.js:67 Native TextInput(Asdfasdf) is 4 events ahead of JS - try to make your JS faster.
(defn simple-text-field []
  (let [current-value (r/atom nil)]
    (fn []
      [text-input {:onChangeText #(reset! current-value %)
                   :value        @current-value

seantempesta03:10:09

Then again, maybe it’s just my iOS simulator? Everything seems to be running slowly.

shidima09:10:00

I’m trying to install boot-react-native as per "http://presumably.de/boot-react-native.html”, but crashes on boot inst:

clojure.lang.ExceptionInfo: No such task (inst)
    data: {:file
           "/var/folders/_w/8wz2746x5_ddxg9y81v4lxv80000gn/T/boot.user8903925845791296877.clj",
           :line 21}
java.lang.IllegalArgumentException: No such task (inst)
          boot.core/construct-tasks  core.clj:  905
                                ...
                 clojure.core/apply  core.clj:  630
                  boot.core/boot/fn  core.clj:  949
clojure.core/binding-conveyor-fn/fn  core.clj: 1916
                                …

misha10:10:15

@seantempesta: replace :value with :defaultvalue

seantempesta10:10:32

@misha I tried that, but then I couldn't update a field that was focused. I ended up doing it the react way and used their setState method using :value. Not sure why it's so janky with reagent.

dzannotti10:10:21

@sineer @levitanong fwiw last night i did a PoC - i couldn't integrate compassus but i totally stole the idea and re-implemented routing with union queries (no add-root! or set-query! neeeded), it totally works, as a quirk you need to implement the NavigatorExperimental reducer yourself, and basically take care of keeping state/real navigation in sync yourself, but the advantage is massive (no need for nested navigation queries either)

levitanong10:10:41

@dzannotti nice! can you put up a repo so we can take a look and learn from you? 😄

dzannotti11:10:42

yeah give me a day or two to clean the code up, it's a total tangled mess atm

dzannotti11:10:53

(tbh nothing to learn, i'm super noob at om-next)

misha11:10:16

@seantempesta if you wrap text-input in a component, and have a changing atom above that component - :defaultValue works much faster.

(rum/defc input [v on-change]
  (text-input {:defaultValue v :onTextChange on-change}))

(rum/defcs user-name > (rum/local "" ::txt) [state]
  (let [txt (::txt state), on-change #(reset! txt %)]
    (input @txt on-change))

misha11:10:37

:value stutters not only in reagent.

sineer17:10:37

@dzannotti I look forward to see what you have done 🙂 I read Compassus code last night and brainstormed how to integrate with @exponent/ex-navigator and I think I have a way to do it, I'll keep you posted on progress I make later this eve..

dzannotti17:10:38

@sineer nothing special, it's a similiar approach to compassus pretty much (union queries with a fixed root component pretty much)

sineer17:10:45

did you integrate with ex-navigator and have drawer (stack-nav drawer--nav-item...) ?

sineer17:10:08

My latest approach is to build a "Compas" Om component init compassus in state and render the nav-provider and feed it a filtered compassus route->component map so that it (Compas) can route using compassus and in the mutation fn set call the nav-provider push/pop "under the hood"... This way I get to use ex-navigator drawer-items with multiple stack-nav and get compassus to drive them stack-nav(s).

dzannotti18:10:04

i didn't integrate the drawer no, but i did write the route->component part yeah