Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react native not suggesting email with TextInput

React Native doesn't suggesting new user's commonly used email address on login form. LoginForm.js and Email.js is functional but it doesn't offer commonly used email addresses of the current user. I am not using firebase, google signing or facebook signing e.g. similar libraries so I need something built in feature of react native already has to make signing in, registering easier for my users.

LoginForm.js

....

<Email
    placeholder={i18n.t("i18n_email")}
    value={this.state.email}
    onChangeText={email => this.validate({ email })}
    autoCorrect={true}
    autoCapitalize="none"
    autoCompleteType="email"/>

....

On Email.js

import React from "react";
import { Text, TextInput, View, StyleSheet } from "react-native";

const styles = StyleSheet.create ({
  inputStyle: {
    zIndex: 1,
    position: 'absolute',

  },
  labelStyle: {
    fontSize: 18,
    paddingLeft: 20
  },
  containerStyle: {
    height: 50,
    flex: 1,
    flexDirection: "row",
    alignItems: "center",
    width: '100%'
  }
});

const Email = ({
  value,
  onChangeText,
  placeholder,
  keyboardType,
  autoCompleteType,
  autoCapitalize
}) => {
  const { inputStyle, labelStyle, containerStyle } = styles;

  return (
    <View style={containerStyle}>
      <TextInput
        placeholder={placeholder}
        value={value}
        onChangeText={onChangeText}
        autoCapitalize={autoCapitalize}
        autoCompleteType={autoCompleteType}
        style={styles.inputStyle}
      />
    </View>
  );
};

export { Email };
like image 765
Engin Yilmaz Avatar asked May 24 '26 22:05

Engin Yilmaz


1 Answers

I use this code. It works on both iOS and Android.

<TextInput
   testID="LoginEmailAddress"
   textContentType="emailAddress"
   keyboardType="email-address"
   style={commonStyles.textInput}
/>
like image 162
Jonas T Avatar answered May 31 '26 11:05

Jonas T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!