question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

interpolateColor issue

See original GitHub issue

I’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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:20

github_iconTop GitHub Comments

3reactions
ahoopencommented, Jul 17, 2020

Its important that the Animated import is from “react-native-reanimated” instead of “react-native”. And also don’t forget to remove the backgroundColor on slider in your styles. And ofcourse you have to set the backgroundColor on the Animated.ScrollView

<Animated.View style={[styles.slider, { backgroundColor }]}>

Hope this helps 😃

3reactions
ahoopencommented, Jul 17, 2020

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} }

<Animated.ScrollView
          {...scrollHandler}
/>
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found