summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRadu-Sebastian Amarie <radu@findie.me>2017-03-22 14:27:11 +0200
committerRadu-Sebastian Amarie <radu@findie.me>2017-03-22 14:27:11 +0200
commit84ff21231227f8bbfa2698a1163b39266d071cdb (patch)
tree3d4c1a707d0d2e18e029378abf4b26355636d705 /src
parente9c12d3d4c4ebf5f6ce83308abcaed9ebcaf5472 (diff)
downloadreact-autosize-textarea-84ff21231227f8bbfa2698a1163b39266d071cdb.zip
react-autosize-textarea-84ff21231227f8bbfa2698a1163b39266d071cdb.tar.gz
react-autosize-textarea-84ff21231227f8bbfa2698a1163b39266d071cdb.tar.bz2
Update: Removed tcomb-react dependency
Diffstat (limited to 'src')
-rw-r--r--src/TextareaAutosize.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/TextareaAutosize.js b/src/TextareaAutosize.js
index 50133d7..d9aeabf 100644
--- a/src/TextareaAutosize.js
+++ b/src/TextareaAutosize.js
@@ -1,16 +1,10 @@
import React from 'react';
import autosize from 'autosize';
-import { t, props } from 'tcomb-react';
const UPDATE = 'autosize:update',
DESTROY = 'autosize:destroy',
RESIZED = 'autosize:resized';
-export const Props = {
- rows: t.maybe(t.Integer),
- maxRows: t.maybe(t.Integer),
- onResize: t.maybe(t.Function)
-};
/** A light replacement for built-in textarea component
* which automaticaly adjusts its height to match the content
@@ -18,7 +12,6 @@ export const Props = {
* @param rows - minimum number of visible rows
* @param maxRows - maximum number of visible rows
*/
-@props(Props, { strict: false })
export default class TextareaAutosize extends React.Component {
static defaultProps = {
@@ -68,7 +61,7 @@ export default class TextareaAutosize extends React.Component {
const numberOfRows = (value || '').split('\n').length;
- return t.Number.is(maxRows) && numberOfRows >= maxRows;
+ return numberOfRows >= parseInt(maxRows);
}
updateMaxHeight = (value) => {
@@ -140,3 +133,9 @@ export default class TextareaAutosize extends React.Component {
}
}
+
+TextareaAutosize.propTypes = {
+ rows: React.PropTypes.number,
+ maxRows: React.PropTypes.number,
+ onResize: React.PropTypes.func
+} \ No newline at end of file