Add autobind decorator and fix Android login screen

This commit is contained in:
John Lyon-Smith
2018-03-27 08:22:40 -07:00
parent da0eb58a8c
commit 7f6bf52334
8 changed files with 21 additions and 23 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { View, Text, TouchableHighlight } from 'react-native'
import { reactAutoBind } from 'auto-bind2'
import autobind from 'autobind-decorator'
export class BoundButton extends React.Component {
static propTypes = {
@@ -15,7 +15,6 @@ export class BoundButton extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
let { name, binder } = this.props
@@ -23,6 +22,7 @@ export class BoundButton extends React.Component {
this.state = binder.getFieldState(name)
}
@autobind
updateValue(e) {
this.setState(e.state)
}

View File

@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { TextInput, Text, View } from 'react-native'
import { reactAutoBind } from 'auto-bind2'
import autobind from 'autobind-decorator'
export class BoundInput extends React.Component {
static propTypes = {
@@ -15,10 +15,10 @@ export class BoundInput extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
this.state = props.binder.getFieldState(props.name)
}
@autobind
handleChangeText(newText) {
const { binder, name } = this.props
const state = binder.getFieldState(name)

View File

@@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import { View, Switch, Text } from 'react-native'
import { reactAutoBind } from 'auto-bind2'
import autobind from 'autobind-decorator'
export class BoundSwitch extends React.Component {
static propTypes = {
@@ -12,10 +12,10 @@ export class BoundSwitch extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
this.state = props.binder.getFieldState(props.name)
}
@autobind
handleValueChange() {
const { binder, name } = this.props
const state = binder.getFieldState(name)