File tree 3 files changed +10
-5
lines changed
packages/react-native-web/src/exports/TextInput
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,12 @@ describe('components/TextInput', () => {
25
25
26
26
test ( 'value "off"' , ( ) => {
27
27
const input = findNativeInput ( shallow ( < TextInput autoComplete = "off" /> ) ) ;
28
- expect ( input . prop ( 'autoComplete' ) ) . toEqual ( 'noop' ) ;
28
+ expect ( input . prop ( 'autoComplete' ) ) . toEqual ( 'off' ) ;
29
+ } ) ;
30
+
31
+ test ( 'autoCompleteType fallback' , ( ) => {
32
+ const input = findNativeInput ( shallow ( < TextInput autoCompleteType = "off" /> ) ) ;
33
+ expect ( input . prop ( 'autoComplete' ) ) . toEqual ( 'off' ) ;
29
34
} ) ;
30
35
} ) ;
31
36
Original file line number Diff line number Diff line change @@ -95,7 +95,8 @@ class TextInput extends React.Component<TextInputProps> {
95
95
render ( ) {
96
96
const {
97
97
autoCapitalize = 'sentences' ,
98
- autoComplete = 'on' ,
98
+ autoComplete,
99
+ autoCompleteType,
99
100
autoCorrect = true ,
100
101
autoFocus,
101
102
defaultValue,
@@ -144,9 +145,7 @@ class TextInput extends React.Component<TextInputProps> {
144
145
145
146
Object . assign ( supportedProps , {
146
147
autoCapitalize,
147
- // Browser's treat autocomplete "off" as "on"
148
- // https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164
149
- autoComplete : autoComplete === 'off' ? 'noop' : autoComplete ,
148
+ autoComplete : autoComplete || autoCompleteType || 'on' ,
150
149
autoCorrect : autoCorrect ? 'on' : 'off' ,
151
150
autoFocus,
152
151
classList : [ classes . textinput ] ,
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export type TextInputProps = {
21
21
...ViewProps ,
22
22
autoCapitalize ?: 'characters' | 'none' | 'sentences' | 'words' ,
23
23
autoComplete ?: string ,
24
+ autoCompleteType ?: string , // Compat with React Native (Bug react-native#26003)
24
25
autoCorrect ?: boolean ,
25
26
autoFocus ?: boolean ,
26
27
blurOnSubmit ?: boolean ,
You can’t perform that action at this time.
0 commit comments