Skip to content

Commit

Permalink
Fix login process issues
Browse files Browse the repository at this point in the history
  • Loading branch information
micahlt committed Sep 4, 2024
1 parent 8b359d6 commit 2c1423f
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions src/screens/LoginScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ function LoginScreen({}) {
num ? 'AndroidPhoneNumberHint provided' : 'user provided'
} number`,
);
const res = await API.loginViaSMS(num != undefined ? num : phoneNumber);
const res = await API.loginViaSMS(
num != undefined && num.length == 10 ? num : phoneNumber,
);
if (res) {
if (res.error_code) {
crashlytics().log(`Error sending SMS code: ${res.error_code}`);
Expand Down Expand Up @@ -344,20 +346,23 @@ function LoginScreen({}) {
Enter the code that you recieved at{' '}
{phoneNumber || 'your phone number.'}
</Text>
<TextInput
mode="outlined"
placeholder="β€” β€” β€” β€” β€” β€”"
style={{
marginBottom: 10,
textAlign: 'center',
}}
autoFocus={true}
value={smsCode}
textContentType="oneTimeCode"
maxLength={6}
autoComplete="one-time-code"
onChangeText={setSmsCode}
/>
<View>
<TextInput
mode="outlined"
placeholder="β€” β€” β€” β€” β€” β€”"
style={{
marginBottom: 10,
textAlign: 'center',
width: '100%',
}}
autoFocus={true}
value={smsCode}
textContentType="oneTimeCode"
maxLength={6}
autoComplete="one-time-code"
onChangeText={setSmsCode}
/>
</View>
<View
style={{
display: 'flex',
Expand All @@ -369,6 +374,7 @@ function LoginScreen({}) {
loading={loading}
onPress={() => {
if (phoneNumber?.length == 10) {
setSmsCode('');
sendSMS();
} else {
setPhase('sendSMS');
Expand All @@ -394,6 +400,7 @@ function LoginScreen({}) {
style={{
marginBottom: 10,
textAlign: 'center',
height: 20,
}}
value={myAge}
keyboardType="number-pad"
Expand Down

0 comments on commit 2c1423f

Please sign in to comment.