Fork me on GitHub
#cljsrn
<
2016-09-22
>
pesterhazy12:09:59

Wow. Apple has managed to make Itunes Connect even worse than it was.

orther15:09:25

That's impressive.

mac21:09:19

I have a RN Switch component which has a on-value-change method. How would I pass the value of the Switch in my #(dispatch ...) function? I have tried #(dispatch [:set-switch [(:id row) (-> % (.-target) (.-value))] but that gives me a undefined is not an object ... target.value

domgetter21:09:30

@mac I believe that :on-value-change is passed the new value, not something you have to call target or value on. #(dispatch [:set-switch [(:id row) %]) should send the current value as %

mac21:09:14

@domgetter So simple 🙂 thanks a lot.

boorad22:09:56

I’m having a brain fart moment...

boorad22:09:02

how would I make this into cljs?

boorad22:09:06

this.props.navigator.push(Router.getRoute("game-list"));

boorad22:09:57

trying (.-push (.-navigator props) (.-getRoute Router route))

boorad22:09:16

and I’ve already let props be (om/props props)

misha22:09:11

js method/fn invocation is (.method), not (.-method)

misha22:09:06

(.push (.-navigator props) (.getRoute Router route)) or even (Router/getRoute route) if it is a class method, not instance one

boorad22:09:18

that tidied things up nicely… thanks @misha

misha22:09:26

does it work?

boorad22:09:36

compiles 🙂

boorad22:09:40

getting to the working part soon

misha22:09:17

not sure about (.-navigator props) too, if you say those are om props now. that might end up as something more clojury, like (:navigator props)

boorad22:09:30

right… I’m trying to figure out how om.next passes this

boorad22:09:56

this is outside the render function, trying to make a helper

boorad22:09:08

but it may still need to be inside the defui somewhere

misha22:09:13

no idea : )

boorad22:09:34

nm, passed it to helper fun from render fun

misha22:09:55

make it as a pure function outside of defui, and pass props as an argument

misha22:09:48

I think you might be able to add it just under the Object protocol extension, like any other lifecycle method:

Object
  (componentDidUpdate [this prev-props prev-state]
    ...
  (my-helper-fn [this that]
    ...

misha22:09:47

and then call it from render like (my-helper-fn this that) (?)

boorad22:09:04

yeah, maybe… but it’d be better outside of the specific Component and reusable across many, so I went the pure function route (so to speak)

boorad22:09:22

this is my attempt at ex-navigation 😐