Skip to content

Commit e6b11e0

Browse files
JoshuaGrossfacebook-github-bot
authored andcommitted
AndroidTextInput: remove enum todos from flow typing
Summary: It looks like codegen supports string enums as long as defaults are provided. Uncommenting the enums and removing TODOs. Reviewed By: rickhanlonii Differential Revision: D17196139 fbshipit-source-id: a076b1a25eb38b23cfd53fd92e8c42f121d08d6b
1 parent 10fe41c commit e6b11e0

File tree

1 file changed

+31
-52
lines changed

1 file changed

+31
-52
lines changed

Libraries/Components/TextInput/AndroidTextInputNativeComponent.js

Lines changed: 31 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ import type {
1717
Double,
1818
Float,
1919
Int32,
20+
WithDefault,
2021
} from 'react-native/Libraries/Types/CodegenTypes';
2122
import type {NativeComponent} from '../../Renderer/shims/ReactNative';
2223
import type {TextStyleProp, ViewStyleProp} from '../../StyleSheet/StyleSheet';
2324
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
2425
import {requireNativeComponent} from 'react-native';
2526

26-
/*export type KeyboardType =
27+
export type KeyboardType =
2728
// Cross Platform
2829
| 'default'
2930
| 'email-address'
@@ -39,9 +40,9 @@ import {requireNativeComponent} from 'react-native';
3940
| 'twitter'
4041
| 'web-search'
4142
// Android-only
42-
| 'visible-password';*/
43+
| 'visible-password';
4344

44-
/*export type ReturnKeyType =
45+
export type ReturnKeyType =
4546
// Cross Platform
4647
| 'done'
4748
| 'go'
@@ -57,7 +58,7 @@ import {requireNativeComponent} from 'react-native';
5758
| 'google'
5859
| 'join'
5960
| 'route'
60-
| 'yahoo';*/
61+
| 'yahoo';
6162

6263
export type NativeProps = $ReadOnly<{|
6364
// This allows us to inherit everything from ViewProps except for style (see below)
@@ -91,25 +92,22 @@ export type NativeProps = $ReadOnly<{|
9192
*
9293
* @platform android
9394
*/
94-
// TODO T53321474: define as flow enum
95-
autoCompleteType?: ?string /*WithDefault<
96-
?(
97-
| 'cc-csc'
98-
| 'cc-exp'
99-
| 'cc-exp-month'
100-
| 'cc-exp-year'
101-
| 'cc-number'
102-
| 'email'
103-
| 'name'
104-
| 'password'
105-
| 'postal-code'
106-
| 'street-address'
107-
| 'tel'
108-
| 'username'
109-
| 'off'
110-
),
95+
autoCompleteType?: WithDefault<
96+
| 'cc-csc'
97+
| 'cc-exp'
98+
| 'cc-exp-month'
99+
| 'cc-exp-year'
100+
| 'cc-number'
101+
| 'email'
102+
| 'name'
103+
| 'password'
104+
| 'postal-code'
105+
| 'street-address'
106+
| 'tel'
107+
| 'username'
108+
| 'off',
111109
'off',
112-
>*/,
110+
>,
113111

114112
/**
115113
* Sets the return key to the label. Use it instead of `returnKeyType`.
@@ -139,8 +137,10 @@ export type NativeProps = $ReadOnly<{|
139137
* The default value is `simple`.
140138
* @platform android
141139
*/
142-
// TODO T53321474: enable enum types in codegen
143-
textBreakStrategy?: string, // ?('simple' | 'highQuality' | 'balanced'),
140+
textBreakStrategy?: WithDefault<
141+
'simple' | 'highQuality' | 'balanced',
142+
'simple',
143+
>,
144144

145145
/**
146146
* The color of the `TextInput` underline.
@@ -193,7 +193,10 @@ export type NativeProps = $ReadOnly<{|
193193
* - `sentences`: first letter of each sentence (*default*).
194194
* - `none`: don't auto capitalize anything.
195195
*/
196-
autoCapitalize?: ?string, // TODO T53321474: define as enum: AutoCapitalize 'none' | 'sentences' | 'words' | 'characters' ,
196+
autoCapitalize?: WithDefault<
197+
'none' | 'sentences' | 'words' | 'characters',
198+
'none',
199+
>,
197200

198201
/**
199202
* If `false`, disables auto-correct. The default value is `true`.
@@ -238,25 +241,13 @@ export type NativeProps = $ReadOnly<{|
238241
* - `email-address`
239242
* - `phone-pad`
240243
*
241-
* *iOS Only*
242-
*
243-
* The following values work on iOS only:
244-
*
245-
* - `ascii-capable`
246-
* - `numbers-and-punctuation`
247-
* - `url`
248-
* - `name-phone-pad`
249-
* - `twitter`
250-
* - `web-search`
251-
*
252244
* *Android Only*
253245
*
254246
* The following values work on Android only:
255247
*
256248
* - `visible-password`
257249
*/
258-
// TODO T53321474: enable enum codegen
259-
keyboardType?: ?string, // ?KeyboardType,
250+
keyboardType?: WithDefault<KeyboardType, 'default'>,
260251

261252
/**
262253
* Determines how the return key should look. On Android you can also use
@@ -278,20 +269,8 @@ export type NativeProps = $ReadOnly<{|
278269
*
279270
* - `none`
280271
* - `previous`
281-
*
282-
* *iOS Only*
283-
*
284-
* The following values work on iOS only:
285-
*
286-
* - `default`
287-
* - `emergency-call`
288-
* - `google`
289-
* - `join`
290-
* - `route`
291-
* - `yahoo`
292-
*/
293-
// TODO T53321474: enable enum codegen
294-
returnKeyType?: ?string, // ?ReturnKeyType,
272+
*/
273+
returnKeyType?: WithDefault<ReturnKeyType, 'done'>,
295274

296275
/**
297276
* Limits the maximum number of characters that can be entered. Use this

0 commit comments

Comments
 (0)