Default to not animating the header background but keep around the translation background interpolator

This commit is contained in:
Brent Vatne 2018-08-22 17:08:36 -07:00
parent 0235caa042
commit 2f42270bc5
2 changed files with 10 additions and 1 deletions

View File

@ -324,8 +324,14 @@ function forCenterFromLeft(props) {
}; };
} }
// Default to no transition
function forBackground() {
return null;
}
// Translate the background with the card
const BACKGROUND_OFFSET = Dimensions.get('window').width; const BACKGROUND_OFFSET = Dimensions.get('window').width;
function forBackground(props) { function forBackgroundWithTranslation(props) {
const { position, scene } = props; const { position, scene } = props;
const interpolate = getSceneIndicesForInterpolationInputRange(props); const interpolate = getSceneIndicesForInterpolationInputRange(props);
if (!interpolate) return { opacity: 0 }; if (!interpolate) return { opacity: 0 };
@ -354,4 +360,5 @@ export default {
forCenter, forCenter,
forRight, forRight,
forBackground, forBackground,
forBackgroundWithTranslation,
}; };

View File

@ -151,6 +151,7 @@ class StackViewLayout extends React.Component {
headerLeftInterpolator, headerLeftInterpolator,
headerTitleInterpolator, headerTitleInterpolator,
headerRightInterpolator, headerRightInterpolator,
headerBackgroundInterpolator,
} = this._getTransitionConfig(); } = this._getTransitionConfig();
const { transitionProps, ...passProps } = this.props; const { transitionProps, ...passProps } = this.props;
@ -168,6 +169,7 @@ class StackViewLayout extends React.Component {
leftInterpolator: headerLeftInterpolator, leftInterpolator: headerLeftInterpolator,
titleInterpolator: headerTitleInterpolator, titleInterpolator: headerTitleInterpolator,
rightInterpolator: headerRightInterpolator, rightInterpolator: headerRightInterpolator,
backgroundInterpolator: headerBackgroundInterpolator,
})} })}
</NavigationProvider> </NavigationProvider>
); );