Fork me on GitHub
#cljsrn
<
2016-04-25
>
frank12:04:10

well that was kind of silly

frank12:04:36

I used the #js reader macro wrong, assuming it would use the keyword names as keys the way clj->js does

vikeri12:04:32

Good to hear that you got it working!

frank13:04:16

when react has .bind(this) in an event handler on a component in JSX, what does this refer to? I'm trying to replicate this using this-as, but I'm not sure how

frank13:04:48

for example:

import {GoogleSignin, GoogleSigninButton} from 'react-native-google-signin';

render() {

  <GoogleSigninButton
    style={{width: 48, height: 48}}
    size={GoogleSigninButton.Size.Icon}
    color={GoogleSigninButton.Color.Dark}
    onPress={this._signIn.bind(this)}/>
}

vikeri13:04:53

The components often have ”methods” that they call like that. Generally that object oriented way of doing things work less well to integrate into cljs. I am not sure but I think this would refer to the react object of the class?

frank13:04:17

so the instance of the GoogleSigninButton class?

frank13:04:03

any ideas on how to do this with js/React.createElement?

vikeri13:04:38

Nope, I’m working with reagent which has its own adapt-react-class so generally I don’t meddle too much in JS-land.

vikeri13:04:58

Apart from when I’m writing pure JS RN...

vikeri13:04:10

But wouldn’t (._signIn google-sign-in-button) work? Is the method just a pure function or is it mutating the object?

vikeri13:04:52

You’ll probably be best of reading the source code of GoogleSigninButton and try to figure out how things work from there...

frank13:04:46

I'm actually starting to think that ._signIn is a property of their parent component

frank13:04:35

I put the JSX into babel repl and got this:

React.createElement(GoogleSigninButton, {
  style: { width: 48, height: 48 },
  size: GoogleSigninButton.Size.Icon,
  color: GoogleSigninButton.Color.Dark,
  onPress: undefined._signIn.bind(undefined) });

frank13:04:59

so I think in their example, they get the signin function from the component and attach it to the parent component class

frank13:04:53

so I can probably find a way to do things the way you mentioned

rikf13:04:29

Can anybody send me some pointers as to how to use a TextEdit component with re-natal. I cant figure out how to capture the value in a text field when a submit button is pressed

vikeri13:04:15

Are you using re-frame or om-next?

vikeri14:04:57

I have been working on trying to get NavigationExperimental to work with re-frame (Oh yes they played along very nicely) and if someone wants to have a look I posted the result here: https://github.com/vikeri/re-navigate

vikeri14:04:38

Possibly thinking one may make it a lib if the re-frame handlers and db prove to be useful.

rikf23:04:37

@vikeri: Apologies for the late reply, I am using re-frame