diff --git a/README.md b/README.md index 855a101..ab8f6af 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ customMessage: PropTypes.shape({ instructions: PropTypes.string, // default: 'Drag-n-drop a file or click to add an image' acceptedFileTypes: PropTypes.string, // default: 'Accepted file types: ' maxFileSize: PropTypes.string, // default: 'Max file size: ' - fileTypeErrorMessage: PropTypes.string, // default: `File size must be less than $BYTES` + fileTypeErrorMessage: PropTypes.string, // default: 'File size must be less than $BYTES'. maxFileSize value can be referenced with '$BYTES' fileSizeErrorMessage: PropTypes.string, // default: 'Invalid file type' }) ``` diff --git a/src/DropNCrop.js b/src/DropNCrop.js index 57cb48b..714e4e2 100644 --- a/src/DropNCrop.js +++ b/src/DropNCrop.js @@ -74,7 +74,7 @@ class DropNCrop extends Component { customMessage, } = this.props; const fileSizeErrorMessage = customMessage.fileSizeErrorMessage - ? customMessage.fileSizeErrorMessage + bytesToSize(maxFileSize) + ? customMessage.fileSizeErrorMessage.replace('$BYTES',bytesToSize(maxFileSize)) : null; const fileSizeValidation = fileSizeLessThan(maxFileSize, fileSizeErrorMessage)(files); const fileTypeValidation = fileType(allowedFileTypes, customMessage.fileTypeErrorMessage)(files);