Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6208

Typescript definitions for Animated.View's style prop

$
0
0

I have component whose Props interface extends ViewProps from React Native, i.e:

export interface Props extends ViewProps {
  // Custom props
}

Naturally, this extends the style prop. There is one caveat, I am using Animated.View and have style like this:

style={{
  opacity: animationCharacter.interpolate({
    inputRange: [0, 1],
    outputRange: [0, 1]
  }),
  transform: [
    {
      scale: animationCharacter.interpolate({
        inputRange: [0, 1],
        outputRange: [1.2, 1]
      })
    }
  ]
}}

I think the interpolate call is incompatible with style typings from ViewProps, but there is no AnimatedViewProps I can extend.

Is there a solution here or will I have to set style: any?


Viewing all articles
Browse latest Browse all 6208

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>