Upgrade to new form binder
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user