简体   繁体   English

React Native:如何在 TextInput 字段中显示 email 自动完成

[英]React Native: How to show email autocompletion in TextInput field

Is it possible in Expo / React Native to have email autocompletion when a user types in their email address in a TextInput?当用户在 TextInput 中输入 email 地址时,Expo / React Native 是否有可能自动完成 email?

For example when I use the app I'm working on my phone and type in john@ my keyboard gives me suggestions for gmail.com, outlook.com, and yahoo.com.例如,当我使用手机上的应用程序并输入john@时,我的键盘会给我建议 gmail.com、outlook.com 和 yahoo.com。

Screenshot of result I want我要的结果截图

I have been trying to get this to work on my iOS Simulator and Android Emulator but can't get this result.我一直试图让它在我的 iOS 模拟器和 Android 模拟器上运行,但无法得到这个结果。

On Expo: 46.0.7 and React Native: 0.69.6Expo: 46.0.7React Native: 0.69.6

These are the properties that I have for my TextInput field这些是我的TextInput字段的属性

<TextInput
  onChangeText={handleEmailChange}
  editable={true}
  placeholder={'Enter a value...'}
  keyboardType="email-address"
  textContentType='emailAddress'
  returnKeyType="done"
  returnKeyLabel="done"
  autoCapitalize="none"
  autoComplete="email"
  ref={emailRef}
  blueOnSubmit={Platform.OS === "ios" ? true : false}
 />

Try passing inputmode='email' https://reactnative.dev/docs/textinput#inputmode尝试传递inputmode='email' https://reactnative.dev/docs/textinput#inputmode

If that doesn't work try this for iOS: https://stackoverflow.com/a/56017919/10657559如果这不起作用,请尝试使用 iOS: https://stackoverflow.com/a/56017919/10657559

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM