You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-10
Original file line number
Diff line number
Diff line change
@@ -51,9 +51,9 @@ Show mask when input is empty and has no focus.
51
51
52
52
Use `inputRef` instead of `ref` if you need input node to manage focus, selection, etc.
53
53
54
-
### `beforeChange` : `function`
54
+
### `beforeMaskedValueChange` : `function`
55
55
56
-
In case you need to implement more complex masking behavior, you can provide `beforeChange` function to change masked value and cursor position before it will be applied to the input. `beforeChange` receives following arguments:
56
+
In case you need to implement more complex masking behavior, you can provide `beforeMaskedValueChange` function to change masked value and cursor position before it will be applied to the input. `beforeMaskedValueChange` receives following arguments:
57
57
1.**value** (string): New masked value.
58
58
2.**cursorPosition** (number): New cursor position. `null` if change was triggered by the `blur` event.
59
59
3.**userInput** (string): Raw entered or pasted string. `null` if user didn't enter anything (e.g. triggered by deletion or rerender due to props change).
@@ -72,11 +72,11 @@ In case you need to implement more complex masking behavior, you can provide `be
72
72
}
73
73
```
74
74
75
-
`beforeChange` must return an object with the following fields:
75
+
`beforeMaskedValueChange` must return an object with the following fields:
76
76
1.**value** (string): New value.
77
77
2.**cursorPosition** (number): New cursor position.
78
78
79
-
Please note that `beforeChange` executes more often than `onChange`, so it's recommended to make it pure.
79
+
Please note that `beforeMaskedValueChange` executes more often than `onChange`, so it's recommended to make it pure.
80
80
81
81
82
82
## Example
@@ -91,7 +91,7 @@ class PhoneInput extends React.Component {
91
91
}
92
92
```
93
93
94
-
Mask for ZIP Code. Uses beforeChange to omit trailing minus if it wasn't entered by user:
94
+
Mask for ZIP Code. Uses beforeMaskedValueChange to omit trailing minus if it wasn't entered by user:
95
95
```jsx
96
96
importReactfrom'react';
97
97
importInputMaskfrom'react-input-mask';
@@ -107,23 +107,28 @@ class Input extends React.Component {
0 commit comments