I happen to have an animation that goes from -1 to 1 and I want to translate those values into the following 2 strings:
'Previous' if the value is negative.
'Next' if the value is positive.
this.state.anim.interpolate({
inputRange: [-1, 0, 1],
outputRange: ['Previous','', 'Next'],
})
Q: How can I use the value that this.state.anim
contains to decide wether we're going to the next screen or to the previous one.
More info:
this.state.anim
receives it's values from a PanGesture
and I'm using this.state.anim
for many other things as well so it would be a shame not to use it here too.