Cannot use a function from a child by reference.
export class Home extends React.Component {
constructor() {
this.imageReference = React.createRef();
}
state = {
fadeAnim: new Animated.Value(0),
}
componentDidMount() {
Animated.timing(
this.state.fadeAnim,
{
toValue: 1,
duration: 2400,
useNativeDriver: true
}
).start(() => this.imageReference.current.initImageAnimation());
}
render() {
let { fadeAnim } = this.state;
return (
<View style={{ flex: 1 }}>
<Animated.View style={{
opacity: fadeAnim,
flex: 1,
backgroundColor: '#7eb3e0',
justifyContent: 'center',
alignItems: 'center'
}}>
<Logo ref={this.imageReference} />
</Animated.View>
</View>
)
}
Error occures: TypeError: undefined is not an object (evaluating '_this.imageReference = _react.default.createRef()')