-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18402 from adamgrzybowski/implement-up-press
[Navigation Reboot] Implement UP press
- Loading branch information
Showing
100 changed files
with
561 additions
and
599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
+ }); | ||
+ } | ||
}; | ||
|
||
private handleGestureEnd = ({ route }: { route: Route<string> }) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.