Open luojinghui opened 7 years ago
start by setting dataSource = [] instead of null in constructor. I don't know if it'll work if you do as I say, but I'm pretty sure it fails if you don't.
it isn't work. please write a simple can you?
Why don't you do this:
var dataSource = new ViewPager.DataSource({
pageHasChanged: (p1, p2) => p1 !== p2,
});
In the constructor and then assign it to state.
Then in the appropriate section of componentDidMount try this:
if (this._isMounted) {
_this.setState({
jnSlides: res,
dataSource: dataSource.cloneWithPages(res)
})
}
Hope it works
` constructor(props) { super(props);
}
componentDidMount() { this._isMounted = true; let uri = 'RotationImages/banner'; let _this = this;
}
_renderPage(data, pageID) { console.log(data); return ( <Image source={data.image} style={styles.slide1}/> ); }
render() { return (
} `
then, have error:
Cannot read property 'pageIdentities of null
how can i resolve?