Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
1408a2d
feat: native-stack (initial changes)
kirillzyusko Oct 11, 2024
cf17480
fix: match previous behavior and close keyboard in chat navigator whe…
kirillzyusko Oct 11, 2024
2f4363c
fix: prettier
kirillzyusko Oct 11, 2024
2d2627a
fix: partially fix CI checks
kirillzyusko Oct 11, 2024
a42c014
fix: eslint
kirillzyusko Oct 11, 2024
e476b1b
fix: removed unused code
kirillzyusko Oct 11, 2024
db5ec12
fix: TS
kirillzyusko Oct 11, 2024
9d30239
fix: rename functions to pass CI
kirillzyusko Oct 11, 2024
df0b5b6
fix: crashes in FlatList on goBack on Android
kirillzyusko Oct 14, 2024
2eddd62
fix: crash when open and close image in chat
kirillzyusko Oct 14, 2024
8f57acc
fix: incorrect merge conflic resolve
kirillzyusko Oct 14, 2024
600088a
fix: not showing up keyboard in ChatFinder screen
kirillzyusko Oct 15, 2024
fb47d6f
fix: iOS un-natural transitions
kirillzyusko Oct 16, 2024
de1eda9
fix: new screen to use new interface
kirillzyusko Oct 16, 2024
a7293da
fix: remove header in FullScreenNavigator
chrispader Oct 6, 2024
5fc7dd7
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 21, 2024
93d37cc
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 22, 2024
64ddf81
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 23, 2024
485fa25
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 24, 2024
1f98e64
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 24, 2024
1356eff
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 24, 2024
a9b8ef3
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 25, 2024
db5a9e3
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 26, 2024
711ae64
remove unused temporary navigator factories
chrispader Oct 26, 2024
853349f
fix: improve naming of (side) modal navigator screen options generators
chrispader Oct 28, 2024
028b62a
fix: further improve naming
chrispader Oct 28, 2024
2516570
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 28, 2024
88ff047
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 30, 2024
1250fc4
fix: background flashing inverse color
chrispader Oct 30, 2024
f6409c4
fix: use correct Navigation theme based on theme
chrispader Oct 30, 2024
6a7b166
remove unused onSubmit prop
chrispader Oct 30, 2024
17a76e3
fix: remove onSubmit prop type
chrispader Oct 30, 2024
4b420a5
fix: modal stack background style
chrispader Oct 30, 2024
2409969
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Oct 30, 2024
756fd60
fix: use `shouldUseNarrowLayout` instead of `isSmallScreenWidth`
chrispader Oct 30, 2024
8538b30
fix: typo
chrispader Oct 31, 2024
00a9c75
fix: unused onSubmit
chrispader Oct 31, 2024
5485e44
add empty line at the end
chrispader Nov 1, 2024
a0404e6
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 4, 2024
eeac6c3
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 7, 2024
88cd73d
fix: prettier
chrispader Nov 7, 2024
d29e08f
fix: Podfile.lock
chrispader Nov 7, 2024
44c238d
fix: remove unused code
chrispader Nov 7, 2024
3640bf2
fix: add `react-native-screens` patch for ios modal unmount flicker
chrispader Nov 7, 2024
e175aff
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 8, 2024
0106161
fix: add RNS patch for android keyboard resizing fix
chrispader Nov 8, 2024
50abafc
fix: description field not automatically focused
chrispader Nov 11, 2024
6437a86
fix: outdated BottomTabBar
chrispader Nov 11, 2024
2210863
fix: improve navigation options file structure
chrispader Nov 11, 2024
55d1eef
fix: fix animation direction and simplify code
chrispader Nov 11, 2024
3e02e4d
fix: use const Presentation values
chrispader Nov 11, 2024
c5004dc
fix: disallow gesture in onboarding modal
chrispader Nov 11, 2024
8e78f30
fix: prevent unnecessary home screen re-mount
chrispader Nov 12, 2024
3f60c7b
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 12, 2024
c88ff39
fix: remove Podfile change
chrispader Nov 12, 2024
a98fcef
fix: remove Podfile.lock change
chrispader Nov 12, 2024
23e9953
remove unused patch
chrispader Nov 12, 2024
df33cef
fix: update Podfile.lock checksum
chrispader Nov 12, 2024
78d3bd5
Merge branch 'feat/edge-to-edge' into @chrispader/use-platform-stack-…
chrispader Nov 12, 2024
f03f765
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 18, 2024
fab9a8b
chore: update pager view patches
chrispader Nov 18, 2024
1c574ac
Revert "Merge branch 'feat/edge-to-edge' into @chrispader/use-platfor…
chrispader Nov 19, 2024
f474be7
docs: add JSDoc comments
chrispader Nov 20, 2024
d0d8539
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 20, 2024
a851cd7
fix: migrate RouteProp in CodesStep component
chrispader Nov 20, 2024
64a302d
chore(deps): update `react-native-pager-view` to 6.5.1
chrispader Nov 20, 2024
863c2f7
chore: update Podfile.lock
chrispader Nov 20, 2024
61cd4cf
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 21, 2024
4cd3c5a
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 22, 2024
2281b02
improve comments
chrispader Nov 23, 2024
106624a
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
chrispader Nov 25, 2024
a5924af
move syncBrowserHistory files
chrispader Nov 25, 2024
a60349c
revert change
chrispader Nov 25, 2024
f7f2557
fix: imports
chrispader Nov 25, 2024
1e36efe
fix: type CentralPaneScreenOptions in AuthScreens
chrispader Nov 25, 2024
c031e8f
fix: initial report not loading on login
chrispader Nov 25, 2024
3ee8c25
fix: simplify code
chrispader Nov 25, 2024
4832dfe
chore: update pods
chrispader Nov 26, 2024
b94528e
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
kirillzyusko Nov 28, 2024
fe01894
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
kirillzyusko Nov 28, 2024
e19f126
fix: StackScreenProps -> PlatformStackScreenProps
kirillzyusko Nov 28, 2024
b8a3ae0
Merge branch 'main' into @chrispader/use-platform-stack-navigation-in…
kirillzyusko Nov 29, 2024
05773fe
refactor: StackScreenProps -> PlatformStackScreenProps
kirillzyusko Nov 29, 2024
85c0dd7
fix: eslint/prettier
kirillzyusko Nov 30, 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
10 changes: 8 additions & 2 deletions src/components/WorkspaceSwitcherButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ type WorkspaceSwitcherButtonOnyxProps = {
policy: OnyxEntry<Policy>;
};

type WorkspaceSwitcherButtonProps = WorkspaceSwitcherButtonOnyxProps;
type WorkspaceSwitcherButtonProps = WorkspaceSwitcherButtonOnyxProps & {
/**
* Callback used to keep track of the workspace switching process in the BaseSidebarScreen.
*/
onSwitchWorkspace?: () => void;
};

function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) {
function WorkspaceSwitcherButton({policy, onSwitchWorkspace}: WorkspaceSwitcherButtonProps) {
const {translate} = useLocalize();
const theme = useTheme();

Expand Down Expand Up @@ -48,6 +53,7 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) {
accessibilityLabel={translate('common.workspaces')}
accessible
onPress={() => {
onSwitchWorkspace?.();
pressableRef?.current?.blur();
interceptAnonymousUser(() => {
Navigation.navigate(ROUTES.WORKSPACE_SWITCHER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';

type TopBarProps = {breadcrumbLabel: string; activeWorkspaceID?: string; shouldDisplaySearch?: boolean; shouldDisplayCancelSearch?: boolean};
type TopBarProps = {
breadcrumbLabel: string;
activeWorkspaceID?: string;
shouldDisplaySearch?: boolean;
shouldDisplayCancelSearch?: boolean;

function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true, shouldDisplayCancelSearch = false}: TopBarProps) {
/**
* Callback used to keep track of the workspace switching process in the BaseSidebarScreen.
* Passed to the WorkspaceSwitcherButton component.
*/
onSwitchWorkspace?: () => void;
};

function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true, shouldDisplayCancelSearch = false, onSwitchWorkspace}: TopBarProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const policy = usePolicy(activeWorkspaceID);
Expand All @@ -42,7 +53,10 @@ function TopBar({breadcrumbLabel, activeWorkspaceID, shouldDisplaySearch = true,
dataSet={{dragArea: true}}
>
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, styles.ml2]}>
<WorkspaceSwitcherButton policy={policy} />
<WorkspaceSwitcherButton
policy={policy}
onSwitchWorkspace={onSwitchWorkspace}
/>

<View style={[styles.ml3, styles.flex1]}>
<Breadcrumbs
Expand Down
13 changes: 12 additions & 1 deletion src/libs/Navigation/switchPolicyID.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getActionFromState} from '@react-navigation/core';
import {CommonActions, getActionFromState} from '@react-navigation/core';
import type {NavigationAction, NavigationContainerRef, NavigationState, PartialState} from '@react-navigation/native';
import {getPathFromState} from '@react-navigation/native';
import type {Writable} from 'type-fest';
Expand Down Expand Up @@ -52,6 +52,17 @@ function getActionForBottomTabNavigator(action: StackNavigationAction, state: Na
params.policyID = policyID;
}

// If there already is a 'Home' route, we want to change the params rather than pushing a new 'Home' route,
// so that the screen does not get re-mounted. This would cause an empty screen/white flash when navigating back from the workspace switcher.
const homeRoute = bottomTabNavigatorRoute.state.routes.at(-1);
if (homeRoute && homeRoute.name === SCREENS.HOME) {
return {
...CommonActions.setParams(params),
source: homeRoute?.key,
};
}

// If there is no 'Home' route, we want to push a new route.
return {
type: CONST.NAVIGATION.ACTION_TYPE.PUSH,
payload: {
Expand Down
19 changes: 17 additions & 2 deletions src/pages/home/sidebar/SidebarScreen/BaseSidebarScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect} from 'react';
import React, {useEffect, useRef} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import ScreenWrapper from '@components/ScreenWrapper';
Expand Down Expand Up @@ -36,11 +36,25 @@ function BaseSidebarScreen() {
Timing.start(CONST.TIMING.SIDEBAR_LOADED);
}, []);

const isSwitchingWorkspace = useRef(false);
useEffect(() => {
if (!!activeWorkspace || activeWorkspaceID === undefined) {
// Whether the active workspace or the "Everything" page is loaded
const isWorkspaceOrEverythingLoaded = !!activeWorkspace || activeWorkspaceID === undefined;

// If we are currently switching workspaces, we don't want to do anything until the target workspace is loaded
if (isSwitchingWorkspace.current) {
if (isWorkspaceOrEverythingLoaded) {
isSwitchingWorkspace.current = false;
}
return;
}

// Otherwise, if the workspace is already loaded, we don't need to do anything
if (isWorkspaceOrEverythingLoaded) {
return;
}

isSwitchingWorkspace.current = true;
Comment on lines +33 to +49

@eh2077 eh2077 Jan 2, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change caused issue App is closed when switching workspace and using device back button.. This changed was reverted and the fix #54030 runs dispatching the navigation action in InteractionManager.runAfterInteractions.

Navigation.navigateWithSwitchPolicyID({policyID: undefined});
updateLastAccessedWorkspace(undefined);
}, [activeWorkspace, activeWorkspaceID]);
Expand All @@ -61,6 +75,7 @@ function BaseSidebarScreen() {
breadcrumbLabel={translate('common.inbox')}
activeWorkspaceID={activeWorkspaceID}
shouldDisplaySearch={shouldDisplaySearch}
onSwitchWorkspace={() => (isSwitchingWorkspace.current = true)}
/>
<View style={[styles.flex1]}>
<SidebarLinksData
Expand Down