Skip to content

Commit e4761e3

Browse files
author
Ian Channing
committed
fix: handle ref callback on unmount when ref is null
See sanniassin#254 - I just didn't like the coding style
1 parent 0096454 commit e4761e3

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.size-snapshot.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{
22
"dist/react-input-mask.js": {
3-
"bundled": 72695,
4-
"minified": 23386,
5-
"gzipped": 7853
3+
"bundled": 72770,
4+
"minified": 23398,
5+
"gzipped": 7859
66
},
77
"lib/react-input-mask.development.js": {
8-
"bundled": 29107,
9-
"minified": 12289,
10-
"gzipped": 4078
8+
"bundled": 29174,
9+
"minified": 12301,
10+
"gzipped": 4083
1111
},
1212
"dist/react-input-mask.min.js": {
13-
"bundled": 30538,
14-
"minified": 10487,
15-
"gzipped": 3761
13+
"bundled": 30613,
14+
"minified": 10499,
15+
"gzipped": 3768
1616
},
1717
"lib/react-input-mask.production.min.js": {
18-
"bundled": 27970,
19-
"minified": 11212,
20-
"gzipped": 3750
18+
"bundled": 28037,
19+
"minified": 11224,
20+
"gzipped": 3755
2121
}
2222
}

src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ const InputMask = forwardRef(function InputMask(props, forwardedRef) {
260260
});
261261

262262
const refCallback = node => {
263+
// handle unmount
264+
if (node === null) {
265+
return;
266+
}
263267
inputRef.current = node;
264268

265269
// if a ref callback is passed to InputMask

0 commit comments

Comments
 (0)