Tek*_*ekk 1 mount react-native react-navigation
在我的第一页上,有一个列表,可通过获取获取。这适用于第一个电话。但是当我使用转到另一个屏幕this.props.navigation.navigate('OtherScreen');并使用
const backAction = NavigationActions.back({
key: null,
});
this.props.navigation.dispatch(backAction)
Run Code Online (Sandbox Code Playgroud)
我的列表不会刷新,因为componentDidMount调用提取的方法不会再次触发。我也尝试过componentWillUpdate,但是不会再次触发。
进入屏幕后,如何强制屏幕重新安装?
小智 5
您可以尝试使用https://facebook.github.io/react/docs/react-component.html#forceupdate。
或者,如果我正确理解了任务
//screen A
import {DeviceEventEmitter} from 'react-native'
componentWillMount() {
DeviceEventEmitter.addListener('your listener', (e)=>{})
}
//screenB
DeviveEventEmitter.emit('your listener', {})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1365 次 |
| 最近记录: |