пожалуйста, проверьте код последующий:Реагировать Native - SetState Предупреждение о втором крепления
componentDidMount() {
/*
* Add listener
* The User has search for a team
*/
teamStore.addChangeListener("SEARCH_TEAMS", this.updateTeams.bind(this));
}
componentWillUnmount() {
/*
* Remove Listener and clear the Store
*/
teamStore.removeChangeListener("SEARCH_TEAMS", this.updateTeams);
teamStore.resetTeams();
}
/*
* The API has find some new teams
* Update the state and show the new teams in the listview
*/
updateTeams() {
var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.setState({dataSource: ds.cloneWithRows(teamStore.getAllTeams())});
}
информации: SEARCH_TEAMSEvent
срабатывает другой Component
.
Если я визуализирую компонент в первый раз, все работает нормально. Но если я сую страницу и снова перейти на эту страницу, я получил это предупреждение:
Предупреждение: SetState (...) можно только обновить установленную или монтажный компонент ...