4

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 3

6

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
Sign up to request clarification or add additional context in comments.

Comments

2

The prop you need to pass is autoCompleteType='off'. You can find more information on the props for the react-native provided TextInput component (who's props React Native Paper's TextInput also extends) here. https://reactnative.dev/docs/textinput.html#autocompletetype

2 Comments

You can check here : snack.expo.io/@kopax/curious-pizza-2 it does not help. Keep in mind I target the web with it, and the resulting html is what you should take in consideration.
I believe autoCompleteType is only for Android & the property is suppose to be autoComplete='off' according to this update: github.com/facebook/react-native/issues/26003. But it doesn't work
1

for ios textContentType={'none'}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.