Merge pull request #24132 from bungu/patch-1

[react-input-mask] Add inputRef type definition
This commit is contained in:
Arthur Ozga
2018-03-15 13:24:37 -07:00
committed by GitHub
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for react-input-mask 0.7
// Type definitions for react-input-mask 1.2
// Project: https://github.com/sanniassin/react-input-mask
// Definitions by: Alexandre Paré <https://github.com/apare>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -36,6 +36,10 @@ declare namespace reactInputMask {
* Show mask even in empty input without focus.
*/
alwaysShowMask?: boolean;
/**
* Use inputRef instead of ref if you need input node to manage focus, selection, etc.
*/
inputRef?: React.Ref<HTMLInputElement>;
}
class ReactInputMask extends React.Component<ReactInputMaskProps> {
}
@@ -1,10 +1,13 @@
import ReactInputMask from 'react-input-mask';
import * as React from 'react';
let ref: HTMLInputElement | null = null;
<div>
<ReactInputMask mask="+4\9 99 999 99" maskChar={null} />
<ReactInputMask mask="+7 (999) 999-99-99" />
<ReactInputMask mask="99-99-9999" defaultValue= "13-00-2017" />
<ReactInputMask mask="99/99/9999" placeholder= "Enter birthdate" />
<ReactInputMask mask="+7 (999) 999-99-99" />
<ReactInputMask mask="+7 (999) 999-99-99" inputRef={(node) => ref = node} />
</div>;