Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix || logic and optimize duration 0
  • Loading branch information
joenoon committed Apr 11, 2016
commit 1256e03cae02e9d3e4bb2a2f9dbfdb3a0bd65b52
14 changes: 9 additions & 5 deletions src/DefaultRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export default class DefaultRenderer extends Component {
if (duration === null || duration === undefined) duration = navigationState.duration;
if (duration !== null && duration !== undefined) {
optionals.applyAnimation = function (pos, navState) {
Animated.timing(pos, {toValue: navState.index, duration}).start();
if (duration === 0) {
pos.setValue(navState.index);
} else {
Animated.timing(pos, {toValue: navState.index, duration}).start();
}
};
}
}
Expand All @@ -90,13 +94,13 @@ export default class DefaultRenderer extends Component {
_renderCard(/*NavigationSceneRendererProps*/ props) {
const isVertical = props.scene.navigationState.direction === "vertical";

const animationStyle = props.scene.navigationState.animationStyle || isVertical ?
const animationStyle = props.scene.navigationState.animationStyle || (isVertical ?
NavigationCardStackStyleInterpolator.forVertical(props) :
NavigationCardStackStyleInterpolator.forHorizontal(props);
NavigationCardStackStyleInterpolator.forHorizontal(props));

const panHandlers = props.scene.navigationState.panHandlers || isVertical ?
const panHandlers = props.scene.navigationState.panHandlers || (isVertical ?
NavigationCardStackPanResponder.forVertical(props) :
NavigationCardStackPanResponder.forHorizontal(props);
NavigationCardStackPanResponder.forHorizontal(props));

return (
<NavigationCard
Expand Down