Skip to content

Commit 0891fd6

Browse files
committed
fix: remove afterChange hook on useFormControl
1 parent cf10884 commit 0891fd6

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

jest.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ module.exports = {
168168
// transform: undefined,
169169

170170
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
171-
// transformIgnorePatterns: [
172-
// "/node_modules/"
173-
// ],
171+
transformIgnorePatterns: ['node_modules/(?!(js-var-type)/)'],
174172

175173
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
176174
// unmockedModulePathPatterns: undefined,

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"eslint-plugin-react": "^7.21.3",
4141
"eslint-plugin-react-hooks": "^4.1.2",
4242
"jest": "^26.5.2",
43-
"js-var-type": "^0.2.3",
43+
"js-var-type": "^0.2.4",
4444
"lodash-es": "^4.17.15",
4545
"prettier": "^2.1.2",
4646
"prop-types": "^15.7.2",
@@ -55,7 +55,7 @@
5555
"webpack-dev-server": "^3.11.0"
5656
},
5757
"peerDependencies": {
58-
"js-var-type": "^0.2.1",
58+
"js-var-type": "^0.2.4",
5959
"lodash-es": "^4.17.15",
6060
"prop-types": "^15.7.2",
6161
"react": "^16.13.1",

src/forms/helpers/useFormControl.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { useContext, useCallback } from 'react';
2-
import { isEmptyStringLike, isBoolean, isFunction } from 'js-var-type';
2+
import { isEmptyStringLike, isBoolean } from 'js-var-type';
33
import { FormContext } from './form-helpers';
44
import { toDatetimeLocal, fromDatetimeLocal } from '../../utils/formatters';
55

6-
export function useFormControl(name, type, hooks = {}) {
6+
export function useFormControl(name, type) {
77
const formState = useContext(FormContext);
88

99
function setValue(value) {
1010
formState.update(name, value);
11-
12-
if (isFunction(hooks.afterChange)) {
13-
hooks.afterChange(value);
14-
}
1511
}
1612

1713
const register = useCallback(

0 commit comments

Comments
 (0)