-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go back to correct page in referral page #32329
Changes from 3 commits
6fb66b9
81fe310
1f22bec
e4a79f8
e86b1c9
d09a81c
2c2b068
d4d348d
a872c6b
a5aa7d0
f5c47d5
7a314ed
7e0f064
1c33b02
91dda0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import React, {useMemo} from 'react'; | ||
import {View} from 'react-native'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import _ from 'underscore'; | ||
|
@@ -54,11 +54,7 @@ function ReferralDetailsPage({route, account}) { | |
const shouldShowBody2 = isShareCode; | ||
const shouldShowClipboard = contentType === CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND || isShareCode; | ||
|
||
function generateReferralURL(email) { | ||
return `${CONST.REFERRAL_PROGRAM.LINK}/?thanks=${encodeURIComponent(email)}`; | ||
} | ||
|
||
function getFallbackRoute() { | ||
const fallBackRoute = useMemo(() => { | ||
const fallbackRoutes = { | ||
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.MONEY_REQUEST]: ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(CONST.IOU.TYPE.REQUEST), | ||
[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SEND_MONEY]: ROUTES.MONEY_REQUEST_PARTICIPANTS.getRoute(CONST.IOU.TYPE.SEND), | ||
|
@@ -67,6 +63,10 @@ function ReferralDetailsPage({route, account}) { | |
}; | ||
|
||
return fallbackRoutes[contentType]; | ||
}, [contentType]); | ||
|
||
function generateReferralURL(email) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please bring back original order of functions |
||
return `${CONST.REFERRAL_PROGRAM.LINK}/?thanks=${encodeURIComponent(email)}`; | ||
} | ||
|
||
return ( | ||
|
@@ -75,10 +75,7 @@ function ReferralDetailsPage({route, account}) { | |
shouldEnableMaxHeight | ||
testID={ReferralDetailsPage.displayName} | ||
> | ||
<HeaderWithBackButton | ||
title={translate('common.referral')} | ||
onBackButtonPress={() => Navigation.goBack(getFallbackRoute())} | ||
/> | ||
<HeaderWithBackButton title={translate('common.referral')} /> | ||
<View style={[styles.justifyContentCenter, styles.alignItemsCenter, styles.ph5, styles.flex1]}> | ||
<Icon | ||
src={PaymentHands} | ||
|
@@ -108,7 +105,7 @@ function ReferralDetailsPage({route, account}) { | |
success | ||
style={[styles.w100]} | ||
text={translate('common.buttonConfirm')} | ||
onPress={() => Navigation.goBack(getFallbackRoute())} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why removing fallback routes from here? In the proposal, you said that we need to change only
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Expected Result: Actual Result: issue: #31628 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ArekChr Updated. |
||
onPress={() => Navigation.goBack(fallBackRoute)} | ||
pressOnEnter | ||
enterKeyEventListenerPriority={1} | ||
/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need memo optimization here, this is a cheap function