Нужна помощь! Что не так с моим кодом? После запуска FadeImage
я получу эту ошибку:
import React from 'react';
import { StyleSheet, Image } from 'react-native';
import * as Icons from '../constants/Icons';
export default class FadeImage extends React.Component {
state = {index:0}
constructor(props) {
super(props);
this.images = [
Icons.BG_1,
Icons.BG_2,
Icons.BG_3,
Icons.BG_4
]
this.next = this.next.bind(this);
}
next() {
setTimeout(() => {
this.setState({index: (this.state.index+1) % 4});
this.next();
}, 3000);
}
componentDidMount() {
this.next();
}
render() {
return (
<Image
style={styles.backgroundImage}
source={this.images[this.state.index]}/>
)
}
}
const styles = StyleSheet.create({
backgroundImage: {
flex: 1,
alignSelf: 'stretch',
width: null,
justifyContent: 'center',
alignItems: 'center'
}
})