Skip to content

Commit

Permalink
TextInput add back propTypes
Browse files Browse the repository at this point in the history
Reviewed By: yungsters

Differential Revision: D12969854

fbshipit-source-id: c2fe2c46e538f8b5e3ea46257aef70d00bf14364
  • Loading branch information
elicwhite authored and facebook-github-bot committed Nov 8, 2018
1 parent 05eefc3 commit f7545f6
Showing 1 changed file with 143 additions and 1 deletion.
144 changes: 143 additions & 1 deletion Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

'use strict';

const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DocumentSelectionState = require('DocumentSelectionState');
const TextStylePropTypes = require('TextStylePropTypes');
const Platform = require('Platform');
const PropTypes = require('prop-types');
const React = require('React');
const ReactNative = require('ReactNative');
const StyleSheet = require('StyleSheet');
Expand All @@ -28,7 +33,6 @@ const {

const emptyFunction = require('fbjs/lib/emptyFunction');
const invariant = require('fbjs/lib/invariant');
const requireNativeComponent = require('requireNativeComponent');
const warning = require('fbjs/lib/warning');
const nullthrows = require('nullthrows');
const setAndForwardRef = require('setAndForwardRef');
Expand Down Expand Up @@ -587,6 +591,144 @@ const TextInputWithRef = React.forwardRef((props, ref) => (

TextInputWithRef.displayName = 'TextInput';

const DataDetectorTypes = [
'phoneNumber',
'link',
'address',
'calendarEvent',
'none',
'all',
];

TextInputWithRef.propTypes = {
...DeprecatedViewPropTypes,
autoCapitalize: PropTypes.oneOf(['none', 'sentences', 'words', 'characters']),
autoCorrect: PropTypes.bool,
spellCheck: PropTypes.bool,
autoFocus: PropTypes.bool,
allowFontScaling: PropTypes.bool,
maxFontSizeMultiplier: PropTypes.number,
editable: PropTypes.bool,
keyboardType: PropTypes.oneOf([
// Cross-platform
'default',
'email-address',
'numeric',
'phone-pad',
'number-pad',
// iOS-only
'ascii-capable',
'numbers-and-punctuation',
'url',
'name-phone-pad',
'decimal-pad',
'twitter',
'web-search',
// Android-only
'visible-password',
]),
keyboardAppearance: PropTypes.oneOf(['default', 'light', 'dark']),
returnKeyType: PropTypes.oneOf([
// Cross-platform
'done',
'go',
'next',
'search',
'send',
// Android-only
'none',
'previous',
// iOS-only
'default',
'emergency-call',
'google',
'join',
'route',
'yahoo',
]),
returnKeyLabel: PropTypes.string,
maxLength: PropTypes.number,
numberOfLines: PropTypes.number,
disableFullscreenUI: PropTypes.bool,
enablesReturnKeyAutomatically: PropTypes.bool,
multiline: PropTypes.bool,
textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']),
onBlur: PropTypes.func,
onFocus: PropTypes.func,
onChange: PropTypes.func,
onChangeText: PropTypes.func,
onContentSizeChange: PropTypes.func,
onTextInput: PropTypes.func,
onEndEditing: PropTypes.func,
onSelectionChange: PropTypes.func,
onSubmitEditing: PropTypes.func,
onKeyPress: PropTypes.func,
onLayout: PropTypes.func,
onScroll: PropTypes.func,
placeholder: PropTypes.string,
placeholderTextColor: DeprecatedColorPropType,
scrollEnabled: PropTypes.bool,
secureTextEntry: PropTypes.bool,
selectionColor: DeprecatedColorPropType,
selectionState: PropTypes.instanceOf(DocumentSelectionState),
selection: PropTypes.shape({
start: PropTypes.number.isRequired,
end: PropTypes.number,
}),
value: PropTypes.string,
defaultValue: PropTypes.string,
clearButtonMode: PropTypes.oneOf([
'never',
'while-editing',
'unless-editing',
'always',
]),
clearTextOnFocus: PropTypes.bool,
selectTextOnFocus: PropTypes.bool,
blurOnSubmit: PropTypes.bool,
style: TextStylePropTypes,
underlineColorAndroid: DeprecatedColorPropType,
inlineImageLeft: PropTypes.string,
inlineImagePadding: PropTypes.number,
dataDetectorTypes: PropTypes.oneOfType([
PropTypes.oneOf(DataDetectorTypes),
PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)),
]),
caretHidden: PropTypes.bool,
contextMenuHidden: PropTypes.bool,
inputAccessoryViewID: PropTypes.string,
textContentType: PropTypes.oneOf([
'none',
'URL',
'addressCity',
'addressCityAndState',
'addressState',
'countryName',
'creditCardNumber',
'emailAddress',
'familyName',
'fullStreetAddress',
'givenName',
'jobTitle',
'location',
'middleName',
'name',
'namePrefix',
'nameSuffix',
'nickname',
'organizationName',
'postalCode',
'streetAddressLine1',
'streetAddressLine2',
'sublocality',
'telephoneNumber',
'username',
'password',
'newPassword',
'oneTimeCode',
]),
};

const styles = StyleSheet.create({
multilineInput: {
// This default top inset makes RCTMultilineTextInputView seem as close as possible
Expand Down

0 comments on commit f7545f6

Please sign in to comment.