Last active
July 15, 2019 13:53
-
-
Save jasmo2/19c596f1afece551bd209106b08d6f11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function fromRight(duration = 300) { | |
return { | |
transitionSpec: { | |
duration, | |
easing: Easing.out(Easing.poly(4)), | |
timing: Animated.timing, | |
useNativeDriver: true, | |
}, | |
screenInterpolator: ({ layout, position, scene }) => { | |
const { index } = scene; | |
const { initWidth } = layout; | |
const translateX = position.interpolate({ | |
inputRange: [index - 1, index, index + 1], | |
outputRange: [initWidth, 0, 0], | |
}); | |
const opacity = position.interpolate({ | |
inputRange: [index - 1, index - 0.99, index], | |
outputRange: [0, 1, 1], | |
}); | |
return { opacity, transform: [{ translateX }] }; | |
}, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment