How to disable autocomplete on react native paper TextInput? with autoComplete="off" render autocomplete="noop" on the web

Viewed 6558

I am trying to disable the autocomplete on the web using TextInput from react-native-paper 3.10.1

<TextInput
  name="city"
  textContentType="addressCity"
  autoComplete="off"
  mode="outlined"
/>

The autoComplete="off" is replaced with autocomplete="noop" in the rendered HTML, which cause the auto complete not to be disabled.

image

From where does the noop come from and how can I disable the autocomplete?

Reproduction

https://snack.expo.io/@kopax/curious-pizza

3 Answers

TextInput in react-native-web API says it follows The HTML autocomplete attribute, but it doesn't work. It does however seem to follow aria-autocomplete.

The TextInput in react-native follows it's own API. But there's this issue that renamed the prop in react native from autoCompleteType to autoComplete. So at the time of writing the React Native docs also need to be updated.

The solution:

<TextInput
  autoComplete={ Platform.OS === 'web' ? 'none' : 'off' }

Tested in:

expo: 42.0.4
react-native: 0.63.2 (https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz)
react-native-web (version): 0.13.18
react: 16.13.1
Browser: Chrome 96.0.4664.110

for ios textContentType={'none'}

Related