GitHubPopular
GitHubPopular copied to clipboard
有几句代码看不懂,望解释下
componentWillUnmount() { this.props.homeComponent.removeSubscriber(this.onSubscriber); }
onSubscriber = (preTab, currentTab)=> {
var changedValues = this.props.homeComponent.changedValues;
if (changedValues.my.themeChange && preTab.styles) {
this.setState({
theme: preTab
})
return;
}
if (currentTab != FLAG_TAB.flag_trendingTab)return;
if (FLAG_TAB.flag_trendingTab === currentTab && changedValues.my.languageChange) {//从设置页面切换过来
this.props.homeComponent.onReStart(FLAG_TAB.flag_trendingTab);
}
}
this.onSubscriber调用的时候是不用传参吗?preTab ,和currentTab 的值是哪来呢,onSubscriber的值又是什么呢 新手问题,望谅解