diff options
-rw-r--r-- | .drone.yml | 14 | ||||
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | src/TextareaAutosize.js | 15 |
3 files changed, 8 insertions, 24 deletions
@@ -9,20 +9,6 @@ build: - npm run lint - npm test - generate-readme: - image: quay.io/buildo/node5-npm3-chrome - commands: - - npm run generate-readme - - git add src/README.md - - if ! git diff-index --quiet HEAD -- src/README.md; then - git config --global user.name "nemobot"; - git config --global user.email "our-bots@buildo.io"; - git commit -m "Update README [skip CI]"; - git push origin master; - fi - when: - branch: master - update-examples: image: quay.io/buildo/node5-npm3-chrome commands: diff --git a/package.json b/package.json index 09d7e47..7bb3f4e 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "react-dom": "^0.14.0 || ^15.0.0" }, "dependencies": { - "autosize": "^3.0.15", - "tcomb-react": "^0.9.3" + "autosize": "^3.0.15" } } 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 |