-
Notifications
You must be signed in to change notification settings - Fork 3k
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 Reboot] Implement UP press #18402
Changes from all commits
dcd9711
3b5e279
f200f22
19a9513
a86fdc6
9aaa242
0a5008e
ab605b0
ad65cec
9b82116
8ee7d09
1e456f6
71d6fed
00f1f82
7e0365d
9748448
619cce2
d6da21d
281a25f
b143205
588b401
db4430d
bafd3bb
44f1f1b
e64177d
6236f7f
dcf5f75
2395ac3
fb4968f
5175d8b
99214de
67a3a2c
8374575
043994f
489e5a0
eee8f27
b2293a7
01f20aa
cc216e9
bd07f59
2162b81
b49cc6d
a9585be
8a8ebbf
e96e7d6
450136b
e5d8bdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
diff --git a/node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx b/node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx | ||
index 1e9ee0e..d85c7b4 100644 | ||
--- a/node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx | ||
+++ b/node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx | ||
@@ -105,14 +105,14 @@ function CardContainer({ | ||
const handleOpen = () => { | ||
const { route } = scene.descriptor; | ||
|
||
- onTransitionEnd({ route }, false); | ||
+ onTransitionEnd({ route }, false, scene.descriptor.navigation.getState()); | ||
onOpenRoute({ route }); | ||
}; | ||
|
||
const handleClose = () => { | ||
const { route } = scene.descriptor; | ||
|
||
- onTransitionEnd({ route }, true); | ||
+ onTransitionEnd({ route }, true, scene.descriptor.navigation.getState()); | ||
onCloseRoute({ route }); | ||
}; | ||
|
||
@@ -120,7 +120,7 @@ function CardContainer({ | ||
const { route } = scene.descriptor; | ||
|
||
onPageChangeStart(); | ||
- onGestureStart({ route }); | ||
+ onGestureStart({ route }, scene.descriptor.navigation.getState()); | ||
}; | ||
|
||
const handleGestureCanceled = () => { | ||
diff --git a/node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx b/node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx | ||
index 6bbce10..7f2eed3 100644 | ||
--- a/node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx | ||
+++ b/node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx | ||
@@ -375,29 +375,51 @@ export default class StackView extends React.Component<Props, State> { | ||
|
||
private handleTransitionStart = ( | ||
{ route }: { route: Route<string> }, | ||
- closing: boolean | ||
- ) => | ||
+ closing: boolean, | ||
+ ) => { | ||
this.props.navigation.emit({ | ||
type: 'transitionStart', | ||
data: { closing }, | ||
target: route.key, | ||
}); | ||
+ } | ||
|
||
private handleTransitionEnd = ( | ||
{ route }: { route: Route<string> }, | ||
- closing: boolean | ||
- ) => | ||
+ closing: boolean, | ||
+ state: StackNavigationState<ParamListBase> | ||
+ ) => { | ||
this.props.navigation.emit({ | ||
type: 'transitionEnd', | ||
data: { closing }, | ||
target: route.key, | ||
}); | ||
+ // Patch introduced to pass information about events to screens lower in the stack, so they could be safely frozen | ||
+ if (state?.index > 1) { | ||
+ this.props.navigation.emit({ | ||
+ type: 'transitionEnd', | ||
+ data: { closing: !closing }, | ||
+ target: state.routes[state.index - 2].key, | ||
+ }); | ||
+ } | ||
+ } | ||
|
||
- private handleGestureStart = ({ route }: { route: Route<string> }) => { | ||
+ private handleGestureStart = ( | ||
+ { route }: { route: Route<string> }, | ||
+ state: StackNavigationState<ParamListBase> | ||
+ ) => { | ||
+ console.log(state) | ||
this.props.navigation.emit({ | ||
type: 'gestureStart', | ||
target: route.key, | ||
}); | ||
+ // Patch introduced to pass information about events to screens lower in the stack, so they could be safely frozen | ||
+ if (state?.index > 1) { | ||
+ this.props.navigation.emit({ | ||
+ type: 'gestureStart', | ||
+ target: state.routes[state.index - 2].key, | ||
+ }); | ||
+ } | ||
Comment on lines
+83
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. Is there PR raised in upstream? |
||
}; | ||
|
||
private handleGestureEnd = ({ route }: { route: Route<string> }) => { |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import {View} from 'react-native'; | |
import BlockingView from './BlockingView'; | ||
import * as Illustrations from '../Icon/Illustrations'; | ||
import withLocalize, {withLocalizePropTypes} from '../withLocalize'; | ||
import HeaderWithCloseButton from '../HeaderWithCloseButton'; | ||
import HeaderWithBackButton from '../HeaderWithBackButton'; | ||
import Navigation from '../../libs/Navigation/Navigation'; | ||
import variables from '../../styles/variables'; | ||
import styles from '../../styles/styles'; | ||
|
@@ -25,12 +25,6 @@ const propTypes = { | |
/** The key in the translations file to use for the subtitle */ | ||
subtitleKey: PropTypes.string, | ||
|
||
/** Whether we should show a back icon */ | ||
shouldShowBackButton: PropTypes.bool, | ||
|
||
/** Whether we should show a close button */ | ||
shouldShowCloseButton: PropTypes.bool, | ||
|
||
/** Whether we should show a go back home link */ | ||
shouldShowBackHomeLink: PropTypes.bool, | ||
|
||
|
@@ -47,23 +41,16 @@ const defaultProps = { | |
titleKey: 'notFound.notHere', | ||
subtitleKey: 'notFound.pageNotFound', | ||
linkKey: 'notFound.goBackHome', | ||
shouldShowBackButton: true, | ||
shouldShowBackHomeLink: false, | ||
shouldShowCloseButton: true, | ||
onBackButtonPress: () => Navigation.dismissModal(), | ||
onBackButtonPress: Navigation.goBack, | ||
}; | ||
|
||
// eslint-disable-next-line rulesdir/no-negated-variables | ||
const FullPageNotFoundView = (props) => { | ||
if (props.shouldShow) { | ||
return ( | ||
<> | ||
<HeaderWithCloseButton | ||
shouldShowBackButton={props.shouldShowBackButton} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removal of Issue: Back Button is shown on desktop in Report Screen |
||
shouldShowCloseButton={props.shouldShowCloseButton} | ||
onBackButtonPress={props.onBackButtonPress} | ||
onCloseButtonPress={() => Navigation.dismissModal()} | ||
/> | ||
<HeaderWithBackButton onBackButtonPress={props.onBackButtonPress} /> | ||
<View style={[styles.flex1, styles.blockingViewContainer]}> | ||
<BlockingView | ||
icon={Illustrations.ToddBehindCloud} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comment what's this for. Is this known issue in upstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not really a bug that would be fixed in
react-navigation
, but it has to be introduced specifically for the architecture of nested navigators and usage ofFreeze
component in the Expensify app. In here we just make sure that the second to last screen in the stack gets information that it cannot be seen. It is necessary, because otherwise a frozen screen could be seen below ie. while using the swipe gesture on iOS.