Skip to content

Commit afb7a15

Browse files
authored
fix: default value for gestureResponseDistance (#1507)
* fix: set default value of gestureResponseDistance prop in index.native.tsx * refact: inline defaultGestureResponseDistance
1 parent 9b3adea commit afb7a15

2 files changed

Lines changed: 7 additions & 23 deletions

File tree

src/index.native.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ class Screen extends React.Component<ScreenProps> {
249249
activityState,
250250
children,
251251
isNativeStack,
252+
gestureResponseDistance,
252253
...props
253254
} = rest;
254255

@@ -276,6 +277,12 @@ class Screen extends React.Component<ScreenProps> {
276277
<AnimatedNativeScreen
277278
{...props}
278279
activityState={activityState}
280+
gestureResponseDistance={{
281+
start: gestureResponseDistance?.start ?? -1,
282+
end: gestureResponseDistance?.end ?? -1,
283+
top: gestureResponseDistance?.top ?? -1,
284+
bottom: gestureResponseDistance?.bottom ?? -1,
285+
}}
279286
// This prevents showing blank screen when navigating between multiple screens with freezing
280287
// https://github.com/software-mansion/react-native-screens/pull/1208
281288
ref={handleRef}

src/native-stack/views/NativeStackView.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -192,29 +192,6 @@ const RouteView = ({
192192
}
193193
}
194194

195-
if (gestureResponseDistance === undefined) {
196-
// default values, required for unification of Fabric & Paper implementation
197-
gestureResponseDistance = {
198-
start: -1,
199-
end: -1,
200-
top: -1,
201-
bottom: -1,
202-
};
203-
} else {
204-
if (gestureResponseDistance.start === undefined) {
205-
gestureResponseDistance.start = -1;
206-
}
207-
if (gestureResponseDistance.end === undefined) {
208-
gestureResponseDistance.end = -1;
209-
}
210-
if (gestureResponseDistance.top === undefined) {
211-
gestureResponseDistance.top = -1;
212-
}
213-
if (gestureResponseDistance.bottom === undefined) {
214-
gestureResponseDistance.bottom = -1;
215-
}
216-
}
217-
218195
if (index === 0) {
219196
// first screen should always be treated as `push`, it resolves problems with no header animation
220197
// for navigator with first screen as `modal` and the next as `push`

0 commit comments

Comments
 (0)