Skip to content

Commit

Permalink
chore: add deafult value for gestureResponseDistance on JS side
Browse files Browse the repository at this point in the history
It is still to be checked whether it is only place where this should be
added
  • Loading branch information
kkafar committed May 13, 2022
1 parent 00506d9 commit c0413bd
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/native-stack/views/NativeStackView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ const RouteView = ({
const { options, render: renderScene } = descriptors[route.key];
const {
gestureEnabled,
gestureResponseDistance,
headerShown,
hideKeyboardOnSwipe,
homeIndicatorHidden,
Expand All @@ -171,6 +170,7 @@ const RouteView = ({
let {
customAnimationOnSwipe,
fullScreenSwipeEnabled,
gestureResponseDistance,
stackAnimation,
stackPresentation = 'push',
} = options;
Expand All @@ -192,6 +192,29 @@ const RouteView = ({
}
}

if (gestureResponseDistance === undefined) {
// default values, required for unification of Fabric & Paper implementation
gestureResponseDistance = {
start: -1,
end: -1,
top: -1,
bottom: -1,
};
} else {
if (gestureResponseDistance.start === undefined) {
gestureResponseDistance.start = -1;
}
if (gestureResponseDistance.end === undefined) {
gestureResponseDistance.end = -1;
}
if (gestureResponseDistance.top === undefined) {
gestureResponseDistance.top = -1;
}
if (gestureResponseDistance.bottom === undefined) {
gestureResponseDistance.bottom = -1;
}
}

if (index === 0) {
// first screen should always be treated as `push`, it resolves problems with no header animation
// for navigator with first screen as `modal` and the next as `push`
Expand Down

0 comments on commit c0413bd

Please sign in to comment.