Skip to content
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

[NoQA] Perf: PlatormStackNavigation - Use @react-navigation/native-stack on mobile platforms #37891

Merged
merged 210 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
7628767
feat: revert native stack to the state when PR was merged
kirillzyusko Feb 29, 2024
349e3b0
fix: cross platform slide_from_left transition
kirillzyusko Mar 6, 2024
afcb123
fix (#37257): use instead of transition
kirillzyusko Mar 7, 2024
90c03a7
fix: ts & eslint
kirillzyusko Mar 8, 2024
047ea38
fix: show profile picture from settings
kirillzyusko Mar 8, 2024
b5e5e7d
fix: consistent transitions on Android for Settings/Profile screen
kirillzyusko Mar 8, 2024
9664f2b
fix: Status screen, pronounce screen, start chat screen -> fixed keyb…
kirillzyusko Mar 8, 2024
8860266
fix: hide keyboard on swipe for Private notes
kirillzyusko Mar 8, 2024
afde8de
feat: added integration with InteractionManager
kirillzyusko Mar 11, 2024
07fb94f
fix: prettier
kirillzyusko Mar 11, 2024
6b6690c
chore: rename patches to be more consistent wwith other changes
kirillzyusko Mar 11, 2024
b9d2262
fix: new chat -> description (keyboard close on back swipe)
kirillzyusko Mar 11, 2024
2aec5af
chore: added PRs references for patches
kirillzyusko Mar 12, 2024
3bc8265
fix: double back press from preferences causes buttons on settings sc…
kirillzyusko Mar 12, 2024
f2c32e6
chore: removed commented out code
kirillzyusko Mar 13, 2024
2fff6cb
fix: leftModalStackNavigator platform specific options
kirillzyusko Mar 15, 2024
ffa510b
fix: incorrect automatic types conversion
kirillzyusko Mar 15, 2024
651bbef
chore: update RNS to latest version, remove patch
kirillzyusko Mar 27, 2024
915bafc
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 15, 2024
6729764
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 16, 2024
ea5172c
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 17, 2024
5ca7316
update deps
chrispader Apr 17, 2024
a0be472
implement typed createPlatformStackNavigator
chrispader Apr 17, 2024
5282af1
simplify abstraction layer
chrispader Apr 17, 2024
3121e45
re-structure platform depdendent stack navigation options
chrispader Apr 17, 2024
3b9b5b0
move files
chrispader Apr 17, 2024
57bfdd2
simplify and improve createPlatformStackNavigator
chrispader Apr 17, 2024
a9dbb9e
fix: default animation
chrispader Apr 17, 2024
85fc4bb
adapt pages
chrispader Apr 17, 2024
75b5cac
add patch for additional (onyx) props
chrispader Apr 18, 2024
1c60ee6
use PlatformStackScreenProps
chrispader Apr 18, 2024
1f78767
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 18, 2024
c5b5775
fix: lint errors
chrispader Apr 18, 2024
23b70c2
fix: pass generic parameter
chrispader Apr 18, 2024
a47a398
replace remaining stack navigators
chrispader Apr 18, 2024
289ba71
restructure styles
chrispader Apr 18, 2024
18fc893
improve platform navigation
chrispader Apr 18, 2024
3b40ab2
update custom navigator factories
chrispader Apr 18, 2024
0dbc9a7
adapt custom navigators
chrispader Apr 19, 2024
b3ec7ef
remove log
chrispader Apr 19, 2024
7ec5d05
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 19, 2024
8c4df3a
remove remaining references to native stack and stack directly
chrispader Apr 19, 2024
f33eba6
update pods
chrispader Apr 19, 2024
884627b
fix: order of animations
chrispader Apr 19, 2024
568cf4a
move files
chrispader Apr 19, 2024
eda54ab
remove Podfile changes
chrispader Apr 19, 2024
de68a31
remove unused defaultScreenOptions
chrispader Apr 19, 2024
f8dc036
update animations
chrispader Apr 19, 2024
e6aae18
add more animations
chrispader Apr 19, 2024
86a3af7
fix: remove animations from bottom tab navigator
chrispader Apr 19, 2024
69a534c
keyboardHandlingEnabled prop only on stack
chrispader Apr 19, 2024
9296237
add default screen options prop
chrispader Apr 19, 2024
346f4e6
remove stack animation props
chrispader Apr 19, 2024
8744c4b
add react import
chrispader Apr 19, 2024
210a95f
fix: bottom tab not working
chrispader Apr 19, 2024
96cd874
add more types
chrispader Apr 19, 2024
b4f3248
add transformScreenOptions function
chrispader Apr 19, 2024
5e453ba
adapt platform stack navigation
chrispader Apr 19, 2024
6e8a07d
rename types
chrispader Apr 19, 2024
57a3250
play around with animations
chrispader Apr 19, 2024
f937f54
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 20, 2024
5acaa45
update patch
chrispader Apr 20, 2024
a346076
fix: patch
chrispader Apr 20, 2024
256ee99
adapt responsive stack navigator
chrispader Apr 20, 2024
c9c2008
adapt
chrispader Apr 20, 2024
15b7689
rename generic parameters
chrispader Apr 20, 2024
48632e7
fix: react navigation types
chrispader Apr 20, 2024
6327d66
move navigators out of factory
chrispader Apr 20, 2024
1080e07
add defaultOptions to CustomBottomTabNavigator
chrispader Apr 20, 2024
6649b86
fix: animations
chrispader Apr 24, 2024
be6b3ed
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 24, 2024
32cfce4
simplify ResponsiveStackNavigator types
chrispader Apr 24, 2024
9f592f3
update Podfile.lock
chrispader Apr 24, 2024
850bb3d
fix: no animation on small screens
chrispader Apr 24, 2024
706dc61
simplify PlatformStackNavigation code
chrispader Apr 24, 2024
10e50c2
simplify ResponsiveStackNavigator
chrispader Apr 24, 2024
26a667a
update type names
chrispader Apr 24, 2024
1620f0c
fix: param
chrispader Apr 24, 2024
43f7848
simplify types
chrispader Apr 24, 2024
2fe3e72
simplify responsive stack navigator
chrispader Apr 24, 2024
85d015e
simplify Bottom tab navigator
chrispader Apr 24, 2024
00fa244
further improve logic of PlatformStackNaivgation
chrispader Apr 24, 2024
6d25042
simplify custom routers
chrispader Apr 24, 2024
56d210f
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 24, 2024
0dcb55e
improve types and add comments
chrispader Apr 24, 2024
8875023
update screen props type usage
chrispader Apr 24, 2024
4b40806
allow nativeOnly and webOnly options
chrispader Apr 24, 2024
a2f16c3
fix: defaultScreenOptions
chrispader Apr 24, 2024
b322da4
fix: last TS error
chrispader Apr 24, 2024
451ce65
fix: lint errors
chrispader Apr 24, 2024
ed39726
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 25, 2024
929c655
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 25, 2024
899f180
fix: navigation updating every render
chrispader Apr 25, 2024
549d0f1
fix: Podfile
chrispader Apr 25, 2024
5a35435
fix: React not found
chrispader Apr 25, 2024
22c0e16
simplify web animations
chrispader Apr 25, 2024
d78c8ed
update patches
chrispader Apr 25, 2024
8ba4ccc
add keyboardHandlingEnabled option to native stack
chrispader Apr 25, 2024
316d44f
use defaultScreenOptions
chrispader Apr 25, 2024
8a4524c
update defaultScreenOptions type
chrispader Apr 25, 2024
09a39b9
fix: bottom tab navigator transformState on native
chrispader Apr 25, 2024
3f094af
Merge branch 'main' into perf/native-stack-v2
chrispader Apr 26, 2024
7c04f3f
change iOS animation
chrispader Apr 26, 2024
26bc827
Merge branch 'main' into perf/native-stack-v2
kirillzyusko Apr 29, 2024
bd961fa
fix: crash when attempt to upload a photo
kirillzyusko Apr 29, 2024
d64570d
chore: update react-native-screens to latest version
kirillzyusko Apr 30, 2024
4292e59
Merge branch 'main' into perf/native-stack-v2
kirillzyusko May 2, 2024
552b978
fix: update lock files
kirillzyusko May 2, 2024
3d37d9d
fix: lint, typescript
kirillzyusko May 2, 2024
c443b1c
fix: typo
kirillzyusko May 6, 2024
fb718b7
fix: issue#4
kirillzyusko May 6, 2024
5cf5c71
Merge branch 'main' into perf/native-stack-v2
kirillzyusko May 7, 2024
1e61de8
fix: CI
kirillzyusko May 7, 2024
935e673
fix: post changes after merge
kirillzyusko May 7, 2024
36d426b
Merge branch 'main' into perf/native-stack-v2
kirillzyusko May 8, 2024
6076420
Merge branch 'main' into perf/native-stack-v2
kirillzyusko May 29, 2024
4142883
Merge branch 'main' into perf/native-stack-v2
kirillzyusko May 29, 2024
f6faabd
Merge branch 'main' into perf/native-stack-v2
chrispader Aug 28, 2024
3e1e8ca
Merge branch 'main' into perf/native-stack-v2
chrispader Aug 28, 2024
2b741ff
fix: merge conflict
chrispader Aug 28, 2024
d068e77
remove outdated file
chrispader Aug 28, 2024
87a9884
fix: TS errors
chrispader Aug 28, 2024
3d068bc
chore: remove Podfile.lock diff
chrispader Aug 28, 2024
4b04c4a
fix: memoize also on native
chrispader Aug 28, 2024
70a6d48
remove TODO comment
chrispader Aug 28, 2024
bea66c0
update web/native only navigation options and rename
chrispader Aug 28, 2024
91ee836
update styles based on recent navigation option rename
chrispader Aug 28, 2024
041262a
migrate stack navigator
chrispader Aug 28, 2024
7129a3c
use CustomRouter
chrispader Aug 28, 2024
239e6ea
extended @react-navigation/core patch
chrispader Aug 28, 2024
2968c26
simplify patch
chrispader Aug 28, 2024
cc81448
fix: patch
chrispader Aug 28, 2024
9aadd77
fix: patch
chrispader Aug 28, 2024
ac34ed9
fix: simplify platform stack logic
chrispader Aug 29, 2024
94c6ec2
simplify navigation option conversion
chrispader Aug 29, 2024
2442679
restructure types
chrispader Aug 29, 2024
5258724
Merge branch 'main' into perf/native-stack-v2
chrispader Aug 29, 2024
7684407
improve patch
chrispader Aug 29, 2024
625a00b
update patch
chrispader Aug 29, 2024
1a992c7
simplify types
chrispader Aug 29, 2024
f132d9c
update patch
chrispader Aug 29, 2024
b97e15a
fix: bottom stack always uses `slide_from_right` animation
chrispader Aug 29, 2024
30b5e48
move PlatformStackNavigatorComponent
chrispader Aug 29, 2024
05e7be0
fix: rename navigator components
chrispader Aug 29, 2024
9927faf
prioritize others over common navigation options
chrispader Aug 29, 2024
af97d99
fix: patch
chrispader Aug 29, 2024
a4effeb
restructure
chrispader Aug 29, 2024
1e4f480
add defaultScreenOptions for PlatformStackNavigator
chrispader Aug 29, 2024
fcb9849
use defaultScreenOptions on navigator
chrispader Aug 29, 2024
63c9f94
use defaultPlatformStackScreenOptions in ResponsiveStackNavigator
chrispader Aug 29, 2024
3ebddd8
add `ios_from_left` animation to `react-native-screens`
chrispader Aug 30, 2024
1dae4dd
use ios like animations on android
chrispader Aug 30, 2024
a07e571
fix: lint errors
chrispader Aug 30, 2024
9c85763
update RNS patch
chrispader Aug 30, 2024
e0a9fc0
update RNS patch
chrispader Aug 30, 2024
ed0c177
update RNS patch
chrispader Aug 30, 2024
1bd5a6a
update patch
chrispader Aug 30, 2024
ecd8b53
update RNS patch
chrispader Aug 30, 2024
e4be7cf
update RNS patch
chrispader Aug 30, 2024
24287b5
update patch
chrispader Sep 2, 2024
2fa23e3
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 3, 2024
5b1e5fb
fix: patch
chrispader Sep 3, 2024
a404e55
update patch
chrispader Sep 3, 2024
3ea4cdd
fix: patch (patch-package bug, renamed files lead to error when patch…
chrispader Sep 3, 2024
296afc1
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 23, 2024
d5e7497
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 23, 2024
b37e0a2
revert unintentional patch change
chrispader Sep 24, 2024
8d50c0c
fix: StackView import
chrispader Sep 24, 2024
8f1dc94
fix: eslint
chrispader Sep 24, 2024
d3c33c4
re-arrange options
chrispader Sep 24, 2024
0527250
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 24, 2024
b90ba70
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 25, 2024
75c40fb
fix: wrong replacements
chrispader Sep 25, 2024
6db8b60
fix: lint
chrispader Sep 25, 2024
0e9cbfd
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 25, 2024
234e91e
disable gesture for no animation screens
chrispader Sep 25, 2024
b7155b1
fix: animation wrong direction in modals
chrispader Sep 25, 2024
c4639ab
update RouteProp types
chrispader Sep 26, 2024
3f4280d
move type
chrispader Sep 26, 2024
88cbda4
fix: missing prop
chrispader Sep 26, 2024
7d7823d
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 29, 2024
fb5a17d
fix: VisionCamera fabric bug, deinit camera session on screen unmount
chrispader Sep 30, 2024
ce4f8c6
update Podfile.lock
chrispader Sep 30, 2024
5701c46
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 30, 2024
c3c7c7a
remove screen and component changes
chrispader Sep 30, 2024
c2062c6
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 30, 2024
4f50477
further remove migration code
chrispader Sep 30, 2024
e3f4372
keep old custom navigator factories
chrispader Sep 30, 2024
78de04c
add back old navigator factories
chrispader Sep 30, 2024
cb2687a
revert Podfile.lock changes
chrispader Sep 30, 2024
300922a
Merge branch 'main' into perf/native-stack-v2
chrispader Sep 30, 2024
225194a
fix: missing react import
chrispader Sep 30, 2024
f32a857
Merge branch 'main' into perf/native-stack-v2
chrispader Oct 4, 2024
525325b
fix: vision camera patch
chrispader Oct 4, 2024
107e5c5
fix: lint and ts
chrispader Oct 4, 2024
d416c6e
Merge branch 'main' into perf/native-stack-v2
chrispader Oct 6, 2024
1d51dbf
fix: lint
chrispader Oct 6, 2024
e989200
fix: apply bottom tab state transformation to mobile as well, because…
kirillzyusko Oct 8, 2024
d880c39
fix: storybook
kirillzyusko Oct 8, 2024
ec2cbe9
fix: create constants and re-use them instead of string duplication
kirillzyusko Oct 8, 2024
e012a79
fix: changes after review
kirillzyusko Oct 8, 2024
922d145
fix: eslint
kirillzyusko Oct 8, 2024
fffd74d
fix: last changes after review
kirillzyusko Oct 8, 2024
064ad5b
fix: eslint
kirillzyusko Oct 8, 2024
0ade1e1
fix: I hope it's last fix for eslint
kirillzyusko Oct 8, 2024
3325a07
fix: eslint
kirillzyusko Oct 8, 2024
6c22124
fix: remove unused properties
kirillzyusko Oct 9, 2024
bf06916
fix: partially resolve new comments
kirillzyusko Oct 9, 2024
3bc381c
fix: removed unused files
kirillzyusko Oct 9, 2024
707e207
fix: refactor types
kirillzyusko Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"@react-native-picker/picker": "2.7.6",
"@react-navigation/material-top-tabs": "^6.6.3",
"@react-navigation/native": "6.1.12",
"@react-navigation/native-stack": "^6.9.26",
"@react-navigation/stack": "6.3.29",
"@react-ng/bounds-observer": "^0.2.1",
"@rnmapbox/maps": "10.1.30",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function adaptStateIfNecessary(state: StackState) {
// - WORKSPACE.INITIAL to cover left pane.
// - WORKSPACE.PROFILE (first workspace settings screen) to cover central pane.
if (!isNarrowLayout) {
if (state.routes.length === 1 && state.routes[0].name === SCREENS.WORKSPACE.INITIAL) {
if (state.routes.length === 1 && state.routes.at(0)?.name === SCREENS.WORKSPACE.INITIAL) {
// @ts-expect-error Updating read only property
// noinspection JSConstantReassignment
state.stale = true; // eslint-disable-line
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
import {useNavigation} from '@react-navigation/native';
import React, {memo, useCallback, useEffect, useState} from 'react';
import {NativeModules, View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import {PressableWithFeedback} from '@components/Pressable';
import type {SearchQueryString} from '@components/Search/types';
import Tooltip from '@components/Tooltip';
import useActiveWorkspace from '@hooks/useActiveWorkspace';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as Session from '@libs/actions/Session';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import Navigation from '@libs/Navigation/Navigation';
import type {AuthScreensParamList} from '@libs/Navigation/types';
import {isCentralPaneName} from '@libs/NavigationUtils';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as SearchUtils from '@libs/SearchUtils';
import type {BrickRoad} from '@libs/WorkspacesSettingsUtils';
import {getChatTabBrickRoad} from '@libs/WorkspacesSettingsUtils';
import navigationRef from '@navigation/navigationRef';
import BottomTabAvatar from '@pages/home/sidebar/BottomTabAvatar';
import BottomTabBarFloatingActionButton from '@pages/home/sidebar/BottomTabBarFloatingActionButton';
import variables from '@styles/variables';
import * as Welcome from '@userActions/Welcome';
import * as OnboardingFlow from '@userActions/Welcome/OnboardingFlow';
import CONST from '@src/CONST';
import NAVIGATORS from '@src/NAVIGATORS';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';

type BottomTabBarProps = {
selectedTab: string | undefined;
};

/**
* Returns SearchQueryString that has policyID correctly set.
*
* When we're coming back to Search Screen we might have pre-existing policyID inside SearchQuery.
* There are 2 cases when we might want to remove this `policyID`:
* - if Policy was removed in another screen
* - if WorkspaceSwitcher was used to globally unset a policyID
* Otherwise policyID will be inserted into query
*/
function handleQueryWithPolicyID(query: SearchQueryString, activePolicyID?: string): SearchQueryString {
const queryJSON = SearchUtils.buildSearchQueryJSON(query);
if (!queryJSON) {
return query;
}

const policyID = activePolicyID ?? queryJSON.policyID;
const policy = PolicyUtils.getPolicy(policyID);

// In case policy is missing or there is no policy currently selected via WorkspaceSwitcher we remove it
if (!activePolicyID || !policy) {
delete queryJSON.policyID;
} else {
queryJSON.policyID = policyID;
}

return SearchUtils.buildSearchQueryString(queryJSON);
}

function BottomTabBar({selectedTab}: BottomTabBarProps) {
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
const navigation = useNavigation();
const {activeWorkspaceID} = useActiveWorkspace();
const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const transactionViolations = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
const [chatTabBrickRoad, setChatTabBrickRoad] = useState<BrickRoad>(getChatTabBrickRoad(activeWorkspaceID));

useEffect(() => {
setChatTabBrickRoad(getChatTabBrickRoad(activeWorkspaceID));
}, [activeWorkspaceID, transactionViolations]);

useEffect(() => {
const navigationState = navigation.getState();
const routes = navigationState?.routes;
const currentRoute = routes?.at(navigationState?.index ?? 0);
// When we are redirected to the Settings tab from the OldDot, we don't want to call the Welcome.show() method.
// To prevent this, the value of the bottomTabRoute?.name is checked here
if (!!(currentRoute && currentRoute.name !== NAVIGATORS.BOTTOM_TAB_NAVIGATOR && !isCentralPaneName(currentRoute.name)) || Session.isAnonymousUser()) {
return;
}

// HybridApp has own entry point when we decide whether to display onboarding and explanation modal.
if (NativeModules.HybridAppModule) {
return;
}

Welcome.isOnboardingFlowCompleted({
onNotCompleted: () => OnboardingFlow.startOnboardingFlow(),
});

// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [isLoadingApp]);

const navigateToChats = useCallback(() => {
if (selectedTab === SCREENS.HOME) {
return;
}
const route = activeWorkspaceID ? (`/w/${activeWorkspaceID}/${ROUTES.HOME}` as Route) : ROUTES.HOME;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is possible to put /w/${activeWorkspaceID}/${ROUTES.HOME} on ROUTES.ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabioh8010 again, I think it's copied/pasted code, so not sure if we need to do that 🙈

And additionally - is it possible to create dynamic routes in ROUTES.ts? Or we want to add two routes and use ternary operator in BottomTabBar.tsx and choose between two routes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered here

Navigation.navigate(route);
}, [activeWorkspaceID, selectedTab]);

const navigateToSearch = useCallback(() => {
if (selectedTab === SCREENS.SEARCH.BOTTOM_TAB) {
return;
}
interceptAnonymousUser(() => {
const rootState = navigationRef.getRootState();
const lastSearchRoute = rootState.routes.filter((route) => route.name === SCREENS.SEARCH.CENTRAL_PANE).at(-1);

if (lastSearchRoute) {
const {q, ...rest} = lastSearchRoute.params as AuthScreensParamList[typeof SCREENS.SEARCH.CENTRAL_PANE];
const cleanedQuery = handleQueryWithPolicyID(q, activeWorkspaceID);

Navigation.navigate(
ROUTES.SEARCH_CENTRAL_PANE.getRoute({
query: cleanedQuery,
...rest,
}),
);
return;
}

const defaultCannedQuery = SearchUtils.buildCannedSearchQuery();
// when navigating to search we might have an activePolicyID set from workspace switcher
const query = activeWorkspaceID ? `${defaultCannedQuery} ${CONST.SEARCH.SYNTAX_ROOT_KEYS.POLICY_ID}:${activeWorkspaceID}` : defaultCannedQuery;
Navigation.navigate(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query}));
});
}, [activeWorkspaceID, selectedTab]);

return (
<View style={styles.bottomTabBarContainer}>
<Tooltip text={translate('common.inbox')}>
<PressableWithFeedback
onPress={navigateToChats}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.inbox')}
wrapperStyle={styles.flex1}
style={styles.bottomTabBarItem}
>
<View>
<Icon
src={Expensicons.Inbox}
fill={selectedTab === SCREENS.HOME ? theme.iconMenu : theme.icon}
width={variables.iconBottomBar}
height={variables.iconBottomBar}
/>
{chatTabBrickRoad && (
<View style={styles.bottomTabStatusIndicator(chatTabBrickRoad === CONST.BRICK_ROAD_INDICATOR_STATUS.INFO ? theme.iconSuccessFill : theme.danger)} />
)}
</View>
</PressableWithFeedback>
</Tooltip>
<Tooltip text={translate('common.search')}>
<PressableWithFeedback
onPress={navigateToSearch}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.search')}
wrapperStyle={styles.flex1}
style={styles.bottomTabBarItem}
>
<View>
<Icon
src={Expensicons.MoneySearch}
fill={selectedTab === SCREENS.SEARCH.BOTTOM_TAB ? theme.iconMenu : theme.icon}
width={variables.iconBottomBar}
height={variables.iconBottomBar}
/>
</View>
</PressableWithFeedback>
</Tooltip>
<BottomTabAvatar isSelected={selectedTab === SCREENS.SETTINGS.ROOT} />
<View style={[styles.flex1, styles.bottomTabBarItem]}>
<BottomTabBarFloatingActionButton />
</View>
</View>
);
}

BottomTabBar.displayName = 'BottomTabBar';

export default memo(BottomTabBar);
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import {View} from 'react-native';
import ScreenWrapper from '@components/ScreenWrapper';
import useThemeStyles from '@hooks/useThemeStyles';
import type {NavigationContentWrapperProps} from '@libs/Navigation/PlatformStackNavigation/types';

function BottomTabNavigationContentWrapper({children, displayName}: NavigationContentWrapperProps) {
const styles = useThemeStyles();

return (
<ScreenWrapper
testID={displayName}
shouldShowOfflineIndicator={false}
shouldEnableKeyboardAvoidingView={false}
shouldEnablePickerAvoiding={false}
>
<View style={styles.flex1}>{children}</View>
</ScreenWrapper>
);
}

export default BottomTabNavigationContentWrapper;
Loading
Loading