React native Iphone如何在React Native中存储和自动填充密码/电子邮件?
我正在React Native中构建一个应用程序,有两个屏幕用于注册和登录。这些屏幕共享用户键入用户名和密码的相同组件(AuthForm)。以下代码是我的AuthForm:React native Iphone如何在React Native中存储和自动填充密码/电子邮件?,react-native,authentication,expo,autofill,mobile-development,React Native,Authentication,Expo,Autofill,Mobile Development,我正在React Native中构建一个应用程序,有两个屏幕用于注册和登录。这些屏幕共享用户键入用户名和密码的相同组件(AuthForm)。以下代码是我的AuthForm: return( <> <Spacer> <Text h4> {headerText} </Text> </Spacer> <Input
return(
<>
<Spacer>
<Text h4> {headerText} </Text>
</Spacer>
<Input
label="Email"
value={email}
onChangeText={setEmail}
autoCapitalize={"none"}
autoCorrect={false}
autoFocus={true} //If true, focuses the input on componentDidMount. The default value is false.
/>
<Spacer/>
<Input
secureTextEntry={true} //This is for keeping secure, replacing with dots.
label="Password"
value={password}
onChangeText={setPassword}
autoCapitalize={"none"}
autoCorrect={false}
/>
{errorMessage ? <Text style={styles.errorMessage}>{errorMessage}</Text> : null}
<Spacer>
<Button title={submitButtonText} onPress={() => onSubmit({email, password})}/>
</Spacer>
</>
);
};
选中textContentType。您可以将其设置为自动填充的
username
或password
,问题是,它会自动填充,正如我显示的注册页面的图片一样。但我没有写任何textContentType。
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"axios": "^0.19.0",
"expo": "^35.0.0",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"react-native-elements": "^1.2.7",
"react-native-gesture-handler": "~1.3.0",
"react-native-reanimated": "~1.2.0",
"react-native-web": "^0.11.7",
"react-navigation-stack": "^1.10.3",
"react-navigation-tabs": "^2.6.0"
},
"devDependencies": {
"babel-preset-expo": "^7.1.0",
"react-navigation": "^4.0.10"
},
"private": true
}