I'm trying to write a react native component in typescript that has a Animated.View from the Animated API in the render function.
I'm having an issue setting the Animated.Value as a property of the React Component.
My current code is as follows:
interface NotificationProps {animation : Animated.Value...}class Notification extends React.Component <NotificationProps,NotificationState> { constructor (props: NotificationProps) { super(props) this.props.animation = new Animated.Value(0) ... this.state = {...}
However, the ts linter produces the error:
Cannot assign to 'animation' because it is a read-only property
In javascript, simply declaring the Animated.Value in the constructor as below works fine:
this.animation = new Animated.Value(0)
I'm using react native v. 0.61.5