Upgrade to new form binder

This commit is contained in:
John Lyon-Smith
2018-05-15 13:09:13 -07:00
parent 8fcfa26063
commit aa2da7d55d
26 changed files with 307 additions and 194 deletions

View File

@@ -1,9 +1,12 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Header } from '.'
import autobind from 'autobind-decorator'
import React from "react"
import PropTypes from "prop-types"
import { Header } from "."
import autobind from "autobind-decorator"
const headerButtonShape = { icon: PropTypes.string.isRequired, onPress: PropTypes.func }
const headerButtonShape = {
icon: PropTypes.string.isRequired,
onPress: PropTypes.func,
}
export class BoundHeader extends React.Component {
static propTypes = {
@@ -20,7 +23,7 @@ export class BoundHeader extends React.Component {
const { name, binder } = this.props
binder.addListener(name, this.updateValue)
this.state = binder.getFieldState(name)
this.state = binder.getBindingState(name)
}
@autobind
@@ -36,7 +39,7 @@ export class BoundHeader extends React.Component {
if (nextProps.binder !== this.props.binder) {
this.props.binder.removeListener(this.props.name, this.updateValue)
nextProps.binder.addListener(nextProps.name, this.updateValue)
this.setState(nextProps.binder.getFieldState(nextProps.name))
this.setState(nextProps.binder.getBindingState(nextProps.name))
}
}
@@ -54,7 +57,8 @@ export class BoundHeader extends React.Component {
title={title}
disabled={disabled}
leftButton={leftButton}
rightButton={rightButton} />
rightButton={rightButton}
/>
)
}
}