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 | |
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
-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 |