Skip to content

Commit

Permalink
[native] remove exitingCallback
Browse files Browse the repository at this point in the history
Summary:
we should just call navigation.goBack when we reach the end of the ordered list of tips. there's no need for the exitingCallback

Depends on D13917

Test Plan: confirmed that when i pressed ok on the final tip, i was backed out from the backdrop

Reviewers: ashoat, tomek

Reviewed By: tomek

Differential Revision: https://phab.comm.dev/D13920
  • Loading branch information
vdhanan committed Nov 13, 2024
1 parent e8675e2 commit 485956d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
5 changes: 0 additions & 5 deletions native/components/nux-tips-context.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { MeasureOnSuccessCallback } from 'react-native/Libraries/Renderer/s

import { values } from 'lib/utils/objects.js';

import type { AppNavigationProp } from '../navigation/app-navigator.react.js';
import type { NUXTipRouteNames } from '../navigation/route-names.js';
import {
CommunityDrawerTipRouteName,
Expand All @@ -26,9 +25,6 @@ export type NUXTip = $Values<typeof nuxTip>;
type NUXTipParams = {
+tooltipLocation: 'below' | 'above' | 'absolute',
+routeName: NUXTipRouteNames,
+exitingCallback?: <Route: NUXTipRouteNames>(
navigation: AppNavigationProp<Route>,
) => void,
};

const firstNUXTipKey = nuxTip.INTRO;
Expand All @@ -49,7 +45,6 @@ const nuxTipParams: { +[NUXTip]: NUXTipParams } = {
[nuxTip.MUTED]: {
routeName: MutedTabTipRouteName,
tooltipLocation: 'below',
exitingCallback: navigation => navigation.goBack(),
},
};

Expand Down
8 changes: 2 additions & 6 deletions native/tooltip/nux-tips-overlay.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,11 @@ function createNUXTipsOverlay<Route: NUXTipRouteNames>(

const onPressOk = React.useCallback(() => {
const { orderedTips, orderedTipsIndex } = route.params;
const { exitingCallback } = tipParams;
goBackOnce();

if (exitingCallback) {
exitingCallback?.(navigation);
}

const nextOrderedTipsIndex = orderedTipsIndex + 1;
if (nextOrderedTipsIndex >= orderedTips.length) {
navigation.goBack();
return;
}

Expand All @@ -448,7 +444,7 @@ function createNUXTipsOverlay<Route: NUXTipRouteNames>(
orderedTipsIndex: nextOrderedTipsIndex,
},
});
}, [goBackOnce, navigation, route.params, tipParams]);
}, [goBackOnce, navigation, route.params]);

const button = React.useMemo(
() =>
Expand Down

0 comments on commit 485956d

Please sign in to comment.