Skip to content

Commit

Permalink
Use canNavigate instead of isReady
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewGable committed Apr 4, 2022
1 parent 86050cc commit 2ef1277
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions src/libs/Navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ function setDidTapNotification() {
didTapNotificationBeforeReady = true;
}

/**
* Returns true if the Navigation is ready to navigate
* @returns {Boolean}
*/
function isReady() {
return navigationRef.isReady();
}

/**
* @param {String} methodName
* @param {Object} params
Expand Down Expand Up @@ -225,11 +217,11 @@ DismissModal.defaultProps = {
};

export default {
canNavigate,
navigate,
dismissModal,
isActiveRoute,
getActiveRoute,
isReady,
goBack,
DismissModal,
closeDrawer,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ function subscribeToReportCommentPushNotifications() {

// Open correct report when push notification is clicked
PushNotification.onSelected(PushNotification.TYPE.REPORT_COMMENT, ({reportID}) => {
if (Navigation.isReady()) {
if (Navigation.canNavigate('navigate')) {
// If a chat is visible other than the one we are trying to navigate to, then we need to navigate back
if (Navigation.getActiveRoute().slice(1, 2) === ROUTES.REPORT && !Navigation.isActiveRoute(`r/${reportID}`)) {
Navigation.goBack();
Expand Down

0 comments on commit 2ef1277

Please sign in to comment.