Skip to content
This repository was archived by the owner on Nov 27, 2022. It is now read-only.

Commit 0269389

Browse files
teabyiisatya164
authored andcommitted
fix: fix PagerPan not triggering onIndexChange when animation is disabled (#632)
`PagerPan` doesn't trigger `props.onIndexChange` when `animationEnabled={false}`. without `Animated.parallel` and it's finished callback, `PagerPan` doesn't call `props.jumpTo` to make it all right. ### Test plan Use `PagerPan` and set `animationEnabled={false}`, should trigger `props.onIndexChange` correctly.
1 parent 211d62a commit 0269389

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PagerPan.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,12 @@ export default class PagerPan<T: *> extends React.Component<Props<T>> {
190190

191191
_transitionTo = (index: number, animated: boolean = true) => {
192192
const offset = -index * this.props.layout.width;
193+
const route = this.props.navigationState.routes[index];
193194

194195
if (this.props.animationEnabled === false || animated === false) {
195196
this.props.panX.setValue(0);
196197
this.props.offsetX.setValue(offset);
198+
this.props.jumpTo(route.key);
197199
return;
198200
}
199201

@@ -210,7 +212,6 @@ export default class PagerPan<T: *> extends React.Component<Props<T>> {
210212
}),
211213
]).start(({ finished }) => {
212214
if (finished) {
213-
const route = this.props.navigationState.routes[index];
214215
this.props.jumpTo(route.key);
215216
this.props.onAnimationEnd && this.props.onAnimationEnd();
216217
this._pendingIndex = null;

0 commit comments

Comments
 (0)