[add] resize 'TextInput' style

Fix #363
This commit is contained in:
Matthias Le Brun
2017-02-16 14:00:58 +01:00
committed by Nicolas Gallagher
parent b653fe0bd3
commit a3ed8f05e6
5 changed files with 24 additions and 4 deletions
+3
View File
@@ -144,6 +144,9 @@ If `true`, all text will automatically be selected on focus.
**style**: style **style**: style
+ ...[Text#style](./Text.md) + ...[Text#style](./Text.md)
+ `resize`
‡ web only.
**testID**: string **testID**: string
@@ -11,6 +11,7 @@ import { PropTypes } from 'react'
import ImageStylePropTypes from '../../components/Image/ImageStylePropTypes' import ImageStylePropTypes from '../../components/Image/ImageStylePropTypes'
import ReactPropTypeLocations from 'react-dom/lib/ReactPropTypeLocations' import ReactPropTypeLocations from 'react-dom/lib/ReactPropTypeLocations'
import ReactPropTypesSecret from 'react-dom/lib/ReactPropTypesSecret' import ReactPropTypesSecret from 'react-dom/lib/ReactPropTypesSecret'
import TextInputStylePropTypes from '../../components/TextInput/TextInputStylePropTypes'
import TextStylePropTypes from '../../components/Text/TextStylePropTypes' import TextStylePropTypes from '../../components/Text/TextStylePropTypes'
import ViewStylePropTypes from '../../components/View/ViewStylePropTypes' import ViewStylePropTypes from '../../components/View/ViewStylePropTypes'
import warning from 'fbjs/lib/warning' import warning from 'fbjs/lib/warning'
@@ -66,6 +67,7 @@ var allStylePropTypes = {};
StyleSheetValidation.addValidStylePropTypes(ImageStylePropTypes) StyleSheetValidation.addValidStylePropTypes(ImageStylePropTypes)
StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes) StyleSheetValidation.addValidStylePropTypes(TextStylePropTypes)
StyleSheetValidation.addValidStylePropTypes(TextInputStylePropTypes)
StyleSheetValidation.addValidStylePropTypes(ViewStylePropTypes) StyleSheetValidation.addValidStylePropTypes(ViewStylePropTypes)
StyleSheetValidation.addValidStylePropTypes({ StyleSheetValidation.addValidStylePropTypes({
appearance: PropTypes.string, appearance: PropTypes.string,
@@ -0,0 +1,14 @@
import TextStylePropTypes from '../Text/TextStylePropTypes';
import { PropTypes } from 'react';
const { oneOf } = PropTypes;
const TextInputOnlyStylePropTypes = {
/* @platform web */
resize: oneOf([ 'none', 'vertical', 'horizontal', 'both' ])
};
module.exports = {
...TextStylePropTypes,
...TextInputOnlyStylePropTypes
};
+4 -3
View File
@@ -5,7 +5,7 @@ import createDOMElement from '../../modules/createDOMElement';
import findNodeHandle from '../../modules/findNodeHandle'; import findNodeHandle from '../../modules/findNodeHandle';
import StyleSheet from '../../apis/StyleSheet'; import StyleSheet from '../../apis/StyleSheet';
import StyleSheetPropType from '../../propTypes/StyleSheetPropType'; import StyleSheetPropType from '../../propTypes/StyleSheetPropType';
import TextStylePropTypes from '../Text/TextStylePropTypes'; import TextInputStylePropTypes from './TextInputStylePropTypes';
import TextareaAutosize from 'react-textarea-autosize'; import TextareaAutosize from 'react-textarea-autosize';
import TextInputState from './TextInputState'; import TextInputState from './TextInputState';
import ViewPropTypes from '../View/ViewPropTypes'; import ViewPropTypes from '../View/ViewPropTypes';
@@ -84,7 +84,7 @@ class TextInput extends Component {
start: PropTypes.number.isRequired, start: PropTypes.number.isRequired,
end: PropTypes.number end: PropTypes.number
}), }),
style: StyleSheetPropType(TextStylePropTypes), style: StyleSheetPropType(TextInputStylePropTypes),
value: PropTypes.string value: PropTypes.string
}; };
@@ -277,7 +277,8 @@ const styles = StyleSheet.create({
boxSizing: 'border-box', boxSizing: 'border-box',
color: 'inherit', color: 'inherit',
font: 'inherit', font: 'inherit',
padding: 0 padding: 0,
resize: 'none'
} }
}); });
+1 -1
View File
@@ -45,5 +45,5 @@ module.exports = {
userSelect: string, userSelect: string,
visibility: hiddenOrVisible, visibility: hiddenOrVisible,
willChange: string, willChange: string,
WebkitOverflowScrolling: oneOf([ 'auto', 'touch' ]), WebkitOverflowScrolling: oneOf([ 'auto', 'touch' ])
}; };