Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c3d194d

Browse files
author
Martin Konicek
committed
[ReactNative] TextInput docs
1 parent f69e33e commit c3d194d

File tree

1 file changed

+41
-21
lines changed

1 file changed

+41
-21
lines changed

Libraries/Components/TextInput/TextInput.js

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ type Event = Object;
7373
* types, such as a numeric keypad.
7474
*
7575
* The simplest use case is to plop down a `TextInput` and subscribe to the
76-
* `onChangeText` events to read the user input. There are also other events,
77-
* such as `onSubmitEditing` and `onFocus` that can be subscribed to. A simple
76+
* `onChangeText` events to read the user input. There are also other events,
77+
* such as `onSubmitEditing` and `onFocus` that can be subscribed to. A simple
7878
* example:
7979
*
8080
* ```
@@ -97,7 +97,6 @@ type Event = Object;
9797
* onSubmitEditing: true,
9898
* };
9999
*/
100-
101100
var TextInput = React.createClass({
102101
propTypes: {
103102
/**
@@ -115,32 +114,44 @@ var TextInput = React.createClass({
115114
'characters',
116115
]),
117116
/**
118-
* If false, disables auto-correct. Default value is true.
117+
* If false, disables auto-correct. The default value is true.
119118
*/
120119
autoCorrect: PropTypes.bool,
121120
/**
122-
* If true, focuses the input on componentDidMount. Default value is false.
121+
* If true, focuses the input on componentDidMount.
122+
* The default value is false.
123123
*/
124124
autoFocus: PropTypes.bool,
125125
/**
126126
* Set the position of the cursor from where editing will begin.
127+
* @platorm android
127128
*/
128129
textAlign: PropTypes.oneOf([
129130
'start',
130131
'center',
131132
'end',
132133
]),
134+
/**
135+
* Aligns text vertically within the TextInput.
136+
* @platform android
137+
*/
133138
textAlignVertical: PropTypes.oneOf([
134139
'top',
135140
'center',
136141
'bottom',
137142
]),
138143
/**
139-
* If false, text is not editable. Default value is true.
144+
* If false, text is not editable. The default value is true.
145+
* @platform ios
140146
*/
141147
editable: PropTypes.bool,
142148
/**
143149
* Determines which keyboard to open, e.g.`numeric`.
150+
*
151+
* The following values work across platforms:
152+
* - default
153+
* - numeric
154+
* - email-address
144155
*/
145156
keyboardType: PropTypes.oneOf([
146157
// Cross-platform
@@ -160,6 +171,7 @@ var TextInput = React.createClass({
160171
]),
161172
/**
162173
* Determines how the return key should look.
174+
* @platform ios
163175
*/
164176
returnKeyType: PropTypes.oneOf([
165177
'default',
@@ -175,17 +187,20 @@ var TextInput = React.createClass({
175187
'emergency-call',
176188
]),
177189
/**
178-
* Limits the maximum number of characters that can be entered. Use this
190+
* Limits the maximum number of characters that can be entered. Use this
179191
* instead of implementing the logic in JS to avoid flicker.
192+
* @platform ios
180193
*/
181194
maxLength: PropTypes.number,
182195
/**
183196
* If true, the keyboard disables the return key when there is no text and
184-
* automatically enables it when there is text. Default value is false.
197+
* automatically enables it when there is text. The default value is false.
198+
* @platform ios
185199
*/
186200
enablesReturnKeyAutomatically: PropTypes.bool,
187201
/**
188-
* If true, the text input can be multiple lines. Default value is false.
202+
* If true, the text input can be multiple lines.
203+
* The default value is false.
189204
*/
190205
multiline: PropTypes.bool,
191206
/**
@@ -214,14 +229,9 @@ var TextInput = React.createClass({
214229
*/
215230
onSubmitEditing: PropTypes.func,
216231
/**
217-
* Invoked on mount and layout changes with {x, y, width, height}.
232+
* Invoked on mount and layout changes with `{x, y, width, height}`.
218233
*/
219234
onLayout: PropTypes.func,
220-
/**
221-
* If true, the text input obscures the text entered so that sensitive text
222-
* like passwords stay secure. Default value is false.
223-
*/
224-
password: PropTypes.bool,
225235
/**
226236
* The string that will be rendered before text input has been entered
227237
*/
@@ -230,17 +240,23 @@ var TextInput = React.createClass({
230240
* The text color of the placeholder string
231241
*/
232242
placeholderTextColor: PropTypes.string,
243+
/**
244+
* If true, the text input obscures the text entered so that sensitive text
245+
* like passwords stay secure. The default value is false.
246+
*/
247+
secureTextEntry: PropTypes.bool,
233248
/**
234249
* See DocumentSelectionState.js, some state that is responsible for
235250
* maintaining selection information for a document
251+
* @platform ios
236252
*/
237253
selectionState: PropTypes.instanceOf(DocumentSelectionState),
238254
/**
239-
* The value to show for the text input. TextInput is a controlled
255+
* The value to show for the text input. TextInput is a controlled
240256
* component, which means the native value will be forced to match this
241-
* value prop if provided. For most uses this works great, but in some
257+
* value prop if provided. For most uses this works great, but in some
242258
* cases this may cause flickering - one common cause is preventing edits
243-
* by keeping value the same. In addition to simply setting the same value,
259+
* by keeping value the same. In addition to simply setting the same value,
244260
* either set `editable={false}`, or set/update `maxLength` to prevent
245261
* unwanted edits without flicker.
246262
*/
@@ -253,6 +269,7 @@ var TextInput = React.createClass({
253269
defaultValue: PropTypes.string,
254270
/**
255271
* When the clear button should appear on the right side of the text view
272+
* @platform ios
256273
*/
257274
clearButtonMode: PropTypes.oneOf([
258275
'never',
@@ -262,22 +279,25 @@ var TextInput = React.createClass({
262279
]),
263280
/**
264281
* If true, clears the text field automatically when editing begins
282+
* @platform ios
265283
*/
266284
clearTextOnFocus: PropTypes.bool,
267285
/**
268-
* If true, selected the text automatically when editing begins
286+
* If true, all text will automatically be selected on focus
287+
* @platform ios
269288
*/
270289
selectTextOnFocus: PropTypes.bool,
271290
/**
272291
* Styles
273292
*/
274293
style: Text.propTypes.style,
275294
/**
276-
* Used to locate this view in end-to-end tests.
295+
* Used to locate this view in end-to-end tests
277296
*/
278297
testID: PropTypes.string,
279298
/**
280-
* The color of the textInput underline. Is only supported on Android.
299+
* The color of the textInput underline.
300+
* @platform android
281301
*/
282302
underlineColorAndroid: PropTypes.string,
283303
},

0 commit comments

Comments
 (0)