interpolateColor issue
See original GitHub issueI’ve been watching react native fashion tutorial and I’ve stucked in this section.
const { scrollHandler, x, y } = useScrollHandler();
const backgroundColor=interpolateColor(x,{
inputRange:[0,width,width*2,width*3],
outputRange:["#BFEAF5","#BEECC4","#FFE4D9","#FFDDDD"]
})
After implementing this in style all my backgrounds are white. How can I fix this ?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:20
Top Results From Across the Web
interpolateColor on Animated.Text stops working #2957 - GitHub
On the first few clicks, while switching tabs a couple times, the text color animation works smoothly. Then it stops interpolating properly and ......
Read more >What is wrong with my React Native Reanimated colour ...
The issue is this: I change isPressed to true when the button is pressed and to false when the user moves his finger...
Read more >Interpolate Colors like a pro with React Native Reanimated 2
Today we are going to understand the concept behind the interpolateColor function from the react-native-reanimated (v2) package.
Read more >Problem "Interpolate Color Between Pixel" deleting row of pixels
Hello, in my game i disabled the "Interpolate color with pixel" option in the Global Game Setting, but i noticed that everytime i...
Read more >interpolateColors | React Native Reanimated
interpolateColors (node, { // Input range for the interpolation. Should be monotonically increasing. inputRange: [nodeOrValue, ...],
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Its important that the
Animated
import is from “react-native-reanimated” instead of “react-native”. And also don’t forget to remove the backgroundColor onslider
in your styles. And ofcourse you have to set the backgroundColor on the Animated.ScrollViewHope this helps 😃
I had the same issue. The problem for me was the wrong way the scrollHandler was set on the
Animated.ScrollView
. So do this, {…scrollHandler} instead of {…{scrollHandler} }