diff --git a/docs/components/TextInput.md b/docs/components/TextInput.md index 7970d0df..e23320b9 100644 --- a/docs/components/TextInput.md +++ b/docs/components/TextInput.md @@ -74,19 +74,13 @@ Determines which keyboard to open. (NOTE: Safari iOS requires an ancestral Limits the maximum number of characters that can be entered. -(web) **maxNumberOfLines**: number = numberOfLines - -Limits the maximum number of lines for a multiline `TextInput`. - -(Requires `multiline` to be `true`.) - **multiline**: bool = false If true, the text input can be multiple lines. **numberOfLines**: number = 2 -Sets the initial number of lines for a multiline `TextInput`. +Sets the number of lines for a multiline `TextInput`. (Requires `multiline` to be `true`.) diff --git a/package.json b/package.json index 4d68ccaf..dc0fff69 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "inline-style-prefixer": "^3.0.2", "normalize-css-color": "^1.0.2", "prop-types": "^15.5.8", - "react-textarea-autosize": "^4.0.4", "react-timer-mixin": "^0.13.3" }, "devDependencies": { diff --git a/src/components/TextInput/__tests__/index-test.js b/src/components/TextInput/__tests__/index-test.js index 90c2ac98..117ca959 100644 --- a/src/components/TextInput/__tests__/index-test.js +++ b/src/components/TextInput/__tests__/index-test.js @@ -1,12 +1,11 @@ /* eslint-env jasmine, jest */ import React from 'react'; -import TextareaAutosize from 'react-textarea-autosize'; import TextInput from '..'; import { mount, shallow } from 'enzyme'; const findNativeInput = wrapper => wrapper.find('input'); -const findNativeTextarea = wrapper => wrapper.find(TextareaAutosize); +const findNativeTextarea = wrapper => wrapper.find('textarea'); const testIfDocumentIsFocused = (message, fn) => { if (document.hasFocus && document.hasFocus()) { @@ -89,21 +88,6 @@ describe('components/TextInput', () => { expect(input.prop('maxLength')).toEqual(10); }); - test('prop "maxNumberOfLines"', () => { - const generateValue = () => { - let str = ''; - while (str.length < 100) { - str += 'x'; - } - return str; - }; - - const input = findNativeTextarea( - shallow() - ); - expect(input.prop('maxRows')).toEqual(3); - }); - test('prop "multiline"', () => { // false let input = findNativeInput(shallow()); @@ -122,7 +106,7 @@ describe('components/TextInput', () => { expect(input.length).toEqual(1); input = findNativeTextarea(shallow()); - expect(input.prop('minRows')).toEqual(3); + expect(input.prop('rows')).toEqual(3); }); test('prop "onBlur"', done => { diff --git a/src/components/TextInput/index.js b/src/components/TextInput/index.js index fbf00096..028eea3e 100644 --- a/src/components/TextInput/index.js +++ b/src/components/TextInput/index.js @@ -7,7 +7,6 @@ import findNodeHandle from '../../modules/findNodeHandle'; import StyleSheet from '../../apis/StyleSheet'; import StyleSheetPropType from '../../propTypes/StyleSheetPropType'; import TextInputStylePropTypes from './TextInputStylePropTypes'; -import TextareaAutosize from 'react-textarea-autosize'; import TextInputState from './TextInputState'; import ViewPropTypes from '../View/ViewPropTypes'; import { bool, func, number, oneOf, shape, string } from 'prop-types'; @@ -74,7 +73,6 @@ class TextInput extends Component { 'web-search' ]), maxLength: number, - maxNumberOfLines: number, multiline: bool, numberOfLines: number, onBlur: func, @@ -143,13 +141,13 @@ class TextInput extends Component { autoCorrect, editable, keyboardType, - maxNumberOfLines, multiline, numberOfLines, secureTextEntry, style, /* eslint-disable */ blurOnSubmit, + clearButtonMode, clearTextOnFocus, dataDetectorTypes, enablesReturnKeyAutomatically, @@ -197,7 +195,7 @@ class TextInput extends Component { type = 'password'; } - const component = multiline ? TextareaAutosize : 'input'; + const component = multiline ? 'textarea' : 'input'; Object.assign(otherProps, { autoCorrect: autoCorrect ? 'on' : 'off', @@ -213,8 +211,7 @@ class TextInput extends Component { }); if (multiline) { - otherProps.maxRows = maxNumberOfLines || numberOfLines; - otherProps.minRows = numberOfLines; + otherProps.rows = numberOfLines; } else { otherProps.type = type; } diff --git a/yarn.lock b/yarn.lock index a5736d81..330ce913 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5254,10 +5254,6 @@ react-test-renderer@^15.5.4: fbjs "^0.8.9" object-assign "^4.1.0" -react-textarea-autosize@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-4.0.5.tgz#55379f6a6fa575fc87d1b8de2756e57e3b6c995d" - react-timer-mixin@^0.13.3: version "0.13.3" resolved "https://registry.yarnpkg.com/react-timer-mixin/-/react-timer-mixin-0.13.3.tgz#0da8b9f807ec07dc3e854d082c737c65605b3d22"