我让 ScreenA 单击下一个 ScreenB 然后返回到 Screen A 不调用函数 componentWillMount()
ScreenA -> Next -> ScreenB -> Back() -> ScreenA
如何在背部动作中重新加载溃败屏幕
类 ScreenA
import React from "react";
import { Button, Text, View } from "react-native";
class ScreenA extends Component {
constructor(props){
super(props)
this.state = {
dataSource: new ListView.DataSource({
rowHasChanged: (row1, row2) => row1 !== row2,
})
}
}
componentWillMount() {
fetch(MYCLASS.DEMAND_LIST_URL, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
userId:'17'})
})
.then((response) => response.json())
.then((responseData) => {
if …Run Code Online (Sandbox Code Playgroud)