Skip to content

Commit 03f710d

Browse files
committed
Make the keyboard nicer on login
Former-commit-id: 8e3ba97
1 parent 2aa8927 commit 03f710d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

screens/Login.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useNavigation } from "@react-navigation/native";
22
import to from "await-to-js";
33
import { signInWithEmailAndPassword, onAuthStateChanged } from "firebase/auth";
4-
import React, { useState, useEffect } from "react";
4+
import React, { useState, useEffect, useRef } from "react";
55
import {
66
View,
77
Text,
@@ -19,9 +19,10 @@ export default function Login() {
1919

2020
const [email, setEmail] = useState("");
2121
const [password, setPassword] = useState("");
22-
2322
const [errorMsg, setErrorMsg] = useState("");
2423

24+
const passwordInputRef = useRef(null);
25+
2526
const navigation = useNavigation();
2627

2728
useEffect(() => {
@@ -77,7 +78,10 @@ export default function Login() {
7778
autoCapitalize="none"
7879
placeholder="Email"
7980
placeholderTextColor="#bebebe"
81+
returnKeyType="next"
82+
keyboardType="email-address"
8083
onChangeText={setEmail}
84+
onSubmitEditing={() => passwordInputRef.current.focus()}
8185
value={email}
8286
/>
8387
<TextInput
@@ -87,10 +91,13 @@ export default function Login() {
8791
AppStyles.lightText,
8892
]}
8993
placeholder="Password"
90-
placeholderTextColor="#bebebe"
94+
placeholderTextColor="#DCDCDC"
95+
returnKeyType="go"
9196
secureTextEntry
9297
onChangeText={setPassword}
98+
onSubmitEditing={validate}
9399
value={password}
100+
ref={passwordInputRef}
94101
/>
95102
<View style={AppStyles.rowContainer}>
96103
<InlineBtn onPress={() => navigation.navigate("ResetPassword")}>

0 commit comments

Comments
 (0)