I'm using NavigationExperimental with React Native. Are any of the lifecycle methods invoked when a pop route happens?
For example: Scene A => Scene B
If I pop the route on Scene B, I want Scene A to re-render.
FirstPageComponent.js
pressBtn() {
let _this = this;
const { navigator } = this.props;
if (navigator) {
navigator.push({
name: 'SecondPageComponent',
component: SecondPageComponent,
title: 'page2',
params: {
name: 'glm',
getFeedBack: function(text) {
_this.setState({feedback: text});
}
}
});
}
}
SecondPageComponent.js:
pressBtn() {
const { navigator } = this.props;
if (navigator) {
this.props.getFeedBack('Im fine');
navigator.pop();
}
}
call getFeedBack When you pop Second page, the getFeedBack will change the state of First page, then First page will be re-rendered.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.