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

[navigation-refactor] Style based approach for the three pane layout #22437

Merged
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
89305e4
switch to style based three pane view
adamgrzybowski Jul 7, 2023
b0bdde7
add temporary patch to never detach HomeScreen
adamgrzybowski Jul 7, 2023
c7e411b
add prettier adjustments
adamgrzybowski Jul 7, 2023
d015ad5
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 7, 2023
82652c9
Merge branch 'main' into @swm/style-based-three-pane-view
WoLewicki Jul 10, 2023
35a1a5d
update comments
adamgrzybowski Jul 10, 2023
e166c92
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 10, 2023
36914d5
Update patches/@react-navigation+stack+6.3.16.patch
adamgrzybowski Jul 11, 2023
17248f5
change name for style object
adamgrzybowski Jul 11, 2023
c63f5f8
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 11, 2023
25b3dc6
fix patch
adamgrzybowski Jul 12, 2023
2cc49e4
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 12, 2023
a897f62
improve patch for stack
adamgrzybowski Jul 13, 2023
59650dc
use better syntax
adamgrzybowski Jul 13, 2023
8424344
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 19, 2023
97ae2e0
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 19, 2023
7d66ad6
add adjustments
adamgrzybowski Jul 19, 2023
c312479
move styles to style file
adamgrzybowski Jul 19, 2023
c48d814
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 20, 2023
2b6f70b
fix prettier
adamgrzybowski Jul 20, 2023
27da40c
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 24, 2023
f3bb2f2
adjust styling
adamgrzybowski Jul 24, 2023
b17c78f
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 25, 2023
59ec44c
fix patch conflicts v2
adamgrzybowski Jul 25, 2023
e16e8f8
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Jul 27, 2023
ddf015e
fix problem with safari
adamgrzybowski Aug 2, 2023
ab49778
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 3, 2023
dbece00
add NoDropZone for RigtModalNavigator
adamgrzybowski Aug 3, 2023
4a2de13
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 3, 2023
af907c5
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 4, 2023
f87274a
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 10, 2023
09fa219
adjustment for position fixed
adamgrzybowski Aug 11, 2023
ad6d7aa
make styles for navigation modal card the same on desktop and web
adamgrzybowski Aug 16, 2023
c3d2154
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 16, 2023
e0a54ab
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 18, 2023
c1b0919
adjust screen in auth screens
adamgrzybowski Aug 18, 2023
ae29512
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 18, 2023
76199a0
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 22, 2023
450aa71
split patch
adamgrzybowski Aug 22, 2023
a6041d8
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 23, 2023
830da58
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 24, 2023
baaf9ab
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 25, 2023
6c823b2
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 28, 2023
ec372f7
Merge branch 'main' into @swm/style-based-three-pane-view
adamgrzybowski Aug 30, 2023
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
19 changes: 19 additions & 0 deletions patches/@react-navigation+stack+6.3.16.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/node_modules/@react-navigation/stack/lib/module/views/Stack/CardStack.js b/node_modules/@react-navigation/stack/lib/module/views/Stack/CardStack.js
index 95e6871..18bb14d 100644
--- a/node_modules/@react-navigation/stack/lib/module/views/Stack/CardStack.js
+++ b/node_modules/@react-navigation/stack/lib/module/views/Stack/CardStack.js
@@ -353,6 +353,14 @@ export default class CardStack extends React.Component {
extrapolate: 'clamp'
}) : STATE_TRANSITIONING_OR_BELOW_TOP;
}
+
+ if (route.name === 'Home' && isScreenActive !== STATE_ON_TOP) {
+ isScreenActive = STATE_TRANSITIONING_OR_BELOW_TOP;
+ }
+
+
+
+
adamgrzybowski marked this conversation as resolved.
Show resolved Hide resolved
const {
headerShown = true,
headerTransparent,
188 changes: 82 additions & 106 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import moment from 'moment';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import {View} from 'react-native';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import CONST from '../../../CONST';
import compose from '../../compose';
Expand All @@ -20,8 +21,7 @@ import Navigation from '../Navigation';
import * as User from '../../actions/User';
import * as Modal from '../../actions/Modal';
import * as Report from '../../actions/Report';
import modalCardStyleInterpolator from './modalCardStyleInterpolator';
import createResponsiveStackNavigator from './createResponsiveStackNavigator';
import createCustomStackNavigator from './createCustomStackNavigator';
import SCREENS from '../../../SCREENS';
import defaultScreenOptions from './defaultScreenOptions';
import * as App from '../../actions/App';
Expand All @@ -30,9 +30,10 @@ import * as Session from '../../actions/Session';
import RightModalNavigator from './Navigators/RightModalNavigator';
import CentralPaneNavigator from './Navigators/CentralPaneNavigator';
import NAVIGATORS from '../../../NAVIGATORS';
import FullScreenNavigator from './Navigators/FullScreenNavigator';
import styles from '../../../styles/styles';
import * as SessionUtils from '../../SessionUtils';
import variables from '../../../styles/variables';
import NotFoundPage from '../../../pages/ErrorPage/NotFoundPage';
import getRootNavigatorScreenOptions from './getRootNavigatorScreenOptions';

let currentUserEmail;
Onyx.connect({
Expand Down Expand Up @@ -67,7 +68,7 @@ Onyx.connect({
},
});

const RootStack = createResponsiveStackNavigator();
const RootStack = createCustomStackNavigator();

// We want to delay the re-rendering for components(e.g. ReportActionCompose)
// that depends on modal visibility until Modal is completely closed and its focused
Expand Down Expand Up @@ -190,109 +191,84 @@ class AuthScreens extends React.Component {
}

render() {
const commonScreenOptions = {
headerShown: false,
gestureDirection: 'horizontal',
animationEnabled: true,
cardStyleInterpolator: (props) => modalCardStyleInterpolator(this.props.isSmallScreenWidth, false, props),
cardOverlayEnabled: true,
animationTypeForReplace: 'push',
};

const rightModalNavigatorScreenOptions = {
...commonScreenOptions,
// we want pop in RHP since there are some flows that would work weird otherwise
animationTypeForReplace: 'pop',
cardStyle: styles.navigationModalCard(this.props.isSmallScreenWidth),
};
const screenOptions = getRootNavigatorScreenOptions(this.props.isSmallScreenWidth);

return (
<RootStack.Navigator
isSmallScreenWidth={this.props.isSmallScreenWidth}
mode="modal"
// We are disabling the default keyboard handling here since the automatic behavior is to close a
// keyboard that's open when swiping to dismiss a modal. In those cases, pressing the back button on
// a header will briefly open and close the keyboard and crash Android.
// eslint-disable-next-line react/jsx-props-no-multi-spaces
keyboardHandlingEnabled={false}
>
<RootStack.Screen
name={SCREENS.HOME}
options={{
...commonScreenOptions,
title: 'New Expensify',

// Prevent unnecessary scrolling
cardStyle: styles.cardStyleNavigator,
}}
getComponent={() => {
const SidebarScreen = require('../../../pages/home/sidebar/SidebarScreen').default;
return SidebarScreen;
}}
/>
<RootStack.Screen
name={NAVIGATORS.CENTRAL_PANE_NAVIGATOR}
options={{
...commonScreenOptions,
title: 'New Expensify',

// Prevent unnecessary scrolling
cardStyle: styles.cardStyleNavigator,
cardStyleInterpolator: (props) => modalCardStyleInterpolator(this.props.isSmallScreenWidth, false, props),
}}
component={CentralPaneNavigator}
/>
<RootStack.Screen
name="ValidateLogin"
options={{
headerShown: false,
title: 'New Expensify',
}}
getComponent={() => {
const ValidateLoginPage = require('../../../pages/ValidateLoginPage').default;
return ValidateLoginPage;
}}
/>
<RootStack.Screen
name={SCREENS.TRANSITION_FROM_OLD_DOT}
options={defaultScreenOptions}
getComponent={() => {
const LogOutPreviousUserPage = require('../../../pages/LogOutPreviousUserPage').default;
return LogOutPreviousUserPage;
}}
/>
<RootStack.Screen
name="Concierge"
options={defaultScreenOptions}
getComponent={() => {
const ConciergePage = require('../../../pages/ConciergePage').default;
return ConciergePage;
}}
/>
<RootStack.Screen
name={SCREENS.REPORT_ATTACHMENTS}
options={{
headerShown: false,
presentation: 'transparentModal',
}}
getComponent={() => {
const ReportAttachments = require('../../../pages/home/report/ReportAttachments').default;
return ReportAttachments;
}}
listeners={modalScreenListeners}
/>
<RootStack.Screen
name={NAVIGATORS.FULL_SCREEN_NAVIGATOR}
options={defaultScreenOptions}
component={FullScreenNavigator}
/>
<RootStack.Screen
name={NAVIGATORS.RIGHT_MODAL_NAVIGATOR}
options={rightModalNavigatorScreenOptions}
component={RightModalNavigator}
listeners={modalScreenListeners}
/>
</RootStack.Navigator>
<View style={{marginLeft: this.props.isSmallScreenWidth ? 0 : variables.sideBarWidth, flex: 1}}>
adamgrzybowski marked this conversation as resolved.
Show resolved Hide resolved
<RootStack.Navigator
isSmallScreenWidth={this.props.isSmallScreenWidth}
mode="modal"
// We are disabling the default keyboard handling here since the automatic behavior is to close a
// keyboard that's open when swiping to dismiss a modal. In those cases, pressing the back button on
// a header will briefly open and close the keyboard and crash Android.
// eslint-disable-next-line react/jsx-props-no-multi-spaces
keyboardHandlingEnabled={false}
>
<RootStack.Screen
name={SCREENS.HOME}
options={screenOptions.homeScreen}
getComponent={() => {
const SidebarScreen = require('../../../pages/home/sidebar/SidebarScreen').default;
return SidebarScreen;
}}
/>
<RootStack.Screen
name={NAVIGATORS.CENTRAL_PANE_NAVIGATOR}
options={screenOptions.centralPaneNavigator}
component={CentralPaneNavigator}
/>
<RootStack.Screen
name="ValidateLogin"
options={{
headerShown: false,
title: 'New Expensify',
adamgrzybowski marked this conversation as resolved.
Show resolved Hide resolved
}}
getComponent={() => {
const ValidateLoginPage = require('../../../pages/ValidateLoginPage').default;
return ValidateLoginPage;
}}
/>
<RootStack.Screen
name={SCREENS.TRANSITION_FROM_OLD_DOT}
options={defaultScreenOptions}
getComponent={() => {
const LogOutPreviousUserPage = require('../../../pages/LogOutPreviousUserPage').default;
return LogOutPreviousUserPage;
}}
/>
<RootStack.Screen
name="Concierge"
adamgrzybowski marked this conversation as resolved.
Show resolved Hide resolved
options={defaultScreenOptions}
getComponent={() => {
const ConciergePage = require('../../../pages/ConciergePage').default;
return ConciergePage;
}}
/>
<RootStack.Screen
name={SCREENS.REPORT_ATTACHMENTS}
options={{
headerShown: false,
presentation: 'transparentModal',
}}
getComponent={() => {
const ReportAttachments = require('../../../pages/home/report/ReportAttachments').default;
return ReportAttachments;
}}
listeners={modalScreenListeners}
/>
<RootStack.Screen
name={SCREENS.NOT_FOUND}
options={screenOptions.notFoundScreen}
component={NotFoundPage}
/>
<RootStack.Screen
name={NAVIGATORS.RIGHT_MODAL_NAVIGATOR}
options={screenOptions.rightModalNavigator}
component={RightModalNavigator}
listeners={modalScreenListeners}
/>
</RootStack.Navigator>
</View>
);
}
}
Expand Down

This file was deleted.

40 changes: 40 additions & 0 deletions src/libs/Navigation/AppNavigator/Navigators/Overlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import {Pressable, StyleSheet, Animated} from 'react-native';
import {useCardAnimation} from '@react-navigation/stack';

import PropTypes from 'prop-types';
import variables from '../../../../styles/variables';
import themeColors from '../../../../styles/themes/default';
import styles from '../../../../styles/styles';

const propTypes = {
/* Callback to close the modal */
onPress: PropTypes.func.isRequired,
};

function Overlay(props) {
const {current} = useCardAnimation();

const overlayStyles = {
adamgrzybowski marked this conversation as resolved.
Show resolved Hide resolved
...StyleSheet.absoluteFillObject,
backgroundColor: themeColors.overlay,
opacity: current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, variables.overlayOpacity],
extrapolate: 'clamp',
}),
};
return (
<Animated.View style={overlayStyles}>
<Pressable
onPress={props.onPress}
style={styles.flex1}
/>
</Animated.View>
);
}

Overlay.propTypes = propTypes;
Overlay.displayName = 'Overlay';

export default Overlay;
Loading