mirror of
https://github.com/vale981/accounts-ui
synced 2025-03-06 02:11:41 -05:00
Added method of adding a ref without interfering with components created outside of a context, i.e. when opening a modal on demand.
This commit is contained in:
parent
5078f6b2ce
commit
b0a0c8a25e
1 changed files with 3 additions and 3 deletions
|
@ -14,8 +14,8 @@ export class Field extends React.Component {
|
||||||
// Trigger an onChange on inital load, to support browser prefilled values.
|
// Trigger an onChange on inital load, to support browser prefilled values.
|
||||||
const { onChange } = this.props;
|
const { onChange } = this.props;
|
||||||
let node = ReactDOM.findDOMNode(this);
|
let node = ReactDOM.findDOMNode(this);
|
||||||
if (this.refs.input) {
|
if (this.input) {
|
||||||
onChange({ target: { value: this.refs.input.value } });
|
onChange({ target: { value: this.input.value } });
|
||||||
}
|
}
|
||||||
// Backward compat.
|
// Backward compat.
|
||||||
else if (node) {
|
else if (node) {
|
||||||
|
@ -55,7 +55,7 @@ export class Field extends React.Component {
|
||||||
<div className={ className }>
|
<div className={ className }>
|
||||||
<label htmlFor={ id }>{ label }</label>
|
<label htmlFor={ id }>{ label }</label>
|
||||||
<input id={ id }
|
<input id={ id }
|
||||||
ref="input"
|
ref={ (ref) => this.input = ref }
|
||||||
type={ type }
|
type={ type }
|
||||||
onChange={ onChange }
|
onChange={ onChange }
|
||||||
placeholder={ hint }
|
placeholder={ hint }
|
||||||
|
|
Loading…
Add table
Reference in a new issue