Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@
"lint"
],
"dependencies": {
"babel-runtime": "6.x",
"async-validator": "1.x",
"babel-runtime": "6.x",
"dom-scroll-into-view": "1.x",
"hoist-non-react-statics": "1.x"
"hoist-non-react-statics": "1.x",
"warning": "^3.0.0"
}
}
19 changes: 9 additions & 10 deletions src/createBaseForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
flatFieldNames, clearVirtualField,
} from './utils';
import AsyncValidator from 'async-validator';
import warning from 'warning';

const DEFAULT_VALIDATE_TRIGGER = 'onChange';
const DEFAULT_TRIGGER = DEFAULT_VALIDATE_TRIGGER;
Expand Down Expand Up @@ -126,22 +127,20 @@ function createBaseForm(option = {}, mixins = []) {
const originalProps = fieldElem.props;
if (process.env.NODE_ENV !== 'production') {
const valuePropName = fieldMeta.valuePropName;
if (valuePropName in originalProps) {
throw new Error(
`\`getFieldDecorator\` will override \`${valuePropName}\`, ` +
warning(
!(valuePropName in originalProps),
`\`getFieldDecorator\` will override \`${valuePropName}\`, ` +
`so please don't set \`${valuePropName}\` directly ` +
`and use \`setFieldsValue\` to set it.`
);
}
);
const defaultValuePropName =
`default${valuePropName[0].toUpperCase()}${valuePropName.slice(1)}`;
if (defaultValuePropName in originalProps) {
throw new Error(
`\`${defaultValuePropName}\` is invalid ` +
warning(
!(defaultValuePropName in originalProps),
`\`${defaultValuePropName}\` is invalid ` +
`for \`getFieldDecorator\` will set \`${valuePropName}\`,` +
` please use \`option.initialValue\` instead.`
);
}
);
}
fieldMeta.originalProps = originalProps;
fieldMeta.ref = fieldElem.ref;
Expand Down