mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-25 07:34:45 +00:00
[fix] TextInput autoComplete="off"
Browsers treat autoComplete "off" as "on". The fix is to provide the browser with an unrecognized value so that it doesn't attempt to auto-fill the input. Fix #1249
This commit is contained in:
@@ -25,7 +25,7 @@ describe('components/TextInput', () => {
|
||||
|
||||
test('value "off"', () => {
|
||||
const input = findNativeInput(shallow(<TextInput autoComplete="off" />));
|
||||
expect(input.prop('autoComplete')).toEqual('off');
|
||||
expect(input.prop('autoComplete')).toEqual('noop');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ class TextInput extends Component<*> {
|
||||
|
||||
render() {
|
||||
const {
|
||||
autoComplete,
|
||||
autoCorrect,
|
||||
editable,
|
||||
keyboardType,
|
||||
@@ -253,6 +254,9 @@ class TextInput extends Component<*> {
|
||||
const component = multiline ? 'textarea' : 'input';
|
||||
|
||||
Object.assign(otherProps, {
|
||||
// Browser's treat autocomplete "off" as "on"
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164
|
||||
autoComplete: autoComplete === 'off' ? 'noop' : autoComplete,
|
||||
autoCorrect: autoCorrect ? 'on' : 'off',
|
||||
dir: 'auto',
|
||||
onBlur: normalizeEventHandler(this._handleBlur),
|
||||
|
||||
Reference in New Issue
Block a user