forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#52305 from nyomanjyotisa/issue-52086
Create SMS delivery failure sign in flow in homepage
- Loading branch information
Showing
5 changed files
with
118 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import {Str} from 'expensify-common'; | ||
import React, {useEffect, useMemo} from 'react'; | ||
import {Keyboard, View} from 'react-native'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import Button from '@components/Button'; | ||
import Text from '@components/Text'; | ||
import useKeyboardState from '@hooks/useKeyboardState'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as Session from '@userActions/Session'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ChangeExpensifyLoginLink from './ChangeExpensifyLoginLink'; | ||
import Terms from './Terms'; | ||
|
||
function SMSDeliveryFailurePage() { | ||
const styles = useThemeStyles(); | ||
const {isKeyboardShown} = useKeyboardState(); | ||
const {translate} = useLocalize(); | ||
const [credentials] = useOnyx(ONYXKEYS.CREDENTIALS); | ||
const [account] = useOnyx(ONYXKEYS.ACCOUNT); | ||
|
||
const login = useMemo(() => { | ||
if (!credentials?.login) { | ||
return ''; | ||
} | ||
return Str.isSMSLogin(credentials.login) ? Str.removeSMSDomain(credentials.login) : credentials.login; | ||
}, [credentials?.login]); | ||
|
||
const SMSDeliveryFailureMessage = account?.SMSDeliveryFailureStatus?.message; | ||
|
||
useEffect(() => { | ||
if (!isKeyboardShown) { | ||
return; | ||
} | ||
Keyboard.dismiss(); | ||
}, [isKeyboardShown]); | ||
|
||
return ( | ||
<> | ||
<View style={[styles.mv3, styles.flexRow]}> | ||
<View style={[styles.flex1]}> | ||
<Text> | ||
{translate('smsDeliveryFailurePage.smsDeliveryFailureMessage', {login})} {SMSDeliveryFailureMessage} | ||
</Text> | ||
</View> | ||
</View> | ||
<View style={[styles.mv4, styles.flexRow, styles.justifyContentBetween, styles.alignItemsEnd]}> | ||
<Button | ||
success | ||
medium | ||
text={translate('common.buttonConfirm')} | ||
onPress={() => Session.clearSignInData()} | ||
pressOnEnter | ||
/> | ||
</View> | ||
<View style={[styles.mt3, styles.mb2]}> | ||
<ChangeExpensifyLoginLink onPress={() => Session.clearSignInData()} /> | ||
</View> | ||
<View style={[styles.mt4, styles.signInPageWelcomeTextContainer]}> | ||
<Terms /> | ||
</View> | ||
</> | ||
); | ||
} | ||
|
||
SMSDeliveryFailurePage.displayName = 'SMSDeliveryFailurePage'; | ||
|
||
export default SMSDeliveryFailurePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters