|
|
@ -1,7 +1,11 @@
|
|
|
|
import React from 'react';
|
|
|
|
import React from 'react';
|
|
|
|
import { findDOMNode } from 'react-dom';
|
|
|
|
import { findDOMNode } from 'react-dom';
|
|
|
|
|
|
|
|
|
|
|
|
export default class InputElement extends React.Component<any, any> {
|
|
|
|
export interface InputElementProps {
|
|
|
|
|
|
|
|
children: React.ReactElement<any>;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default class InputElement extends React.Component<InputElementProps, any> {
|
|
|
|
private ele: HTMLInputElement;
|
|
|
|
private ele: HTMLInputElement;
|
|
|
|
|
|
|
|
|
|
|
|
focus = () => {
|
|
|
|
focus = () => {
|
|
|
@ -12,7 +16,7 @@ export default class InputElement extends React.Component<any, any> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
saveRef = (ele: HTMLInputElement) => {
|
|
|
|
saveRef = (ele: HTMLInputElement) => {
|
|
|
|
this.ele = ele;
|
|
|
|
this.ele = ele;
|
|
|
|
const childRef = this.props.children.ref;
|
|
|
|
const { ref: childRef } = this.props.children as any;
|
|
|
|
if (typeof childRef === 'function') {
|
|
|
|
if (typeof childRef === 'function') {
|
|
|
|
childRef(ele);
|
|
|
|
childRef(ele);
|
|
|
|
}
|
|
|
|
}
|
|
|
|