diff options
author | Francesco Cioria <firefelix@gmail.com> | 2017-03-29 11:31:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 11:31:17 +0200 |
commit | 91b84634c3162dd7ee59a90dcf90b171fa25060f (patch) | |
tree | 87e659b3932bcb59e91436f138b2d71f65b68ab5 /src/TextareaAutosize.js | |
parent | e9c12d3d4c4ebf5f6ce83308abcaed9ebcaf5472 (diff) | |
parent | 01f3fbf9f72b6c1459850418db72bf26f9fa737f (diff) | |
download | react-autosize-textarea-91b84634c3162dd7ee59a90dcf90b171fa25060f.zip react-autosize-textarea-91b84634c3162dd7ee59a90dcf90b171fa25060f.tar.gz react-autosize-textarea-91b84634c3162dd7ee59a90dcf90b171fa25060f.tar.bz2 |
Merge pull request #32 from eek/master
Update: Removed tcomb-react dependency
Diffstat (limited to 'src/TextareaAutosize.js')
-rw-r--r-- | src/TextareaAutosize.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/TextareaAutosize.js b/src/TextareaAutosize.js index 50133d7..1a04017 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 |