Reactjs TabNavigator(单击选项卡时)不';t调用React Native的生命周期方法

Reactjs TabNavigator(单击选项卡时)不';t调用React Native的生命周期方法,reactjs,react-native,react-native-android,react-native-ios,Reactjs,React Native,React Native Android,React Native Ios,我将在我的应用程序中添加选项卡栏,第一次调用react native的生命周期很好。还可以在第一时间从webservice获取数据。但现在我将更改“单击无人调用”上的选项卡。我想在每次更改选项卡时更新视图 它的意思是希望在更改选项卡时使用webservice更新视图。 没有调用任何一个方法: componentWillMount componentDidMount componentWillReceiveProps shouldComponentUpdate componentWillUpdat

我将在我的应用程序中添加选项卡栏,第一次调用react native的生命周期很好。还可以在第一时间从webservice获取数据。但现在我将更改“单击无人调用”上的选项卡。我想在每次更改选项卡时更新视图

它的意思是希望在更改选项卡时使用webservice更新视图。

没有调用任何一个方法:

componentWillMount
componentDidMount
componentWillReceiveProps
shouldComponentUpdate
componentWillUpdate
componentWillUnmount
componentDidUpdate
GIF

**这取决于您如何使用tabbar**
const Tabs=TabNavigator(
{
Tab1:{screen:TabList1},
Tab2:{screen:TabList2},
},
{
initialRouteName:'Tab1',
是的,
animationEnabled:没错,
},
);
然后
标签=(道具)=>{
如果(道具){
返回(

);
}
**在这里打电话**
yourrefeshcall=()=>{
}
**这取决于您如何使用tabbar**
const Tabs=TabNavigator(
{
Tab1:{screen:TabList1},
Tab2:{screen:TabList2},
},
{
initialRouteName:'Tab1',
是的,
animationEnabled:没错,
},
);
然后
标签=(道具)=>{
如果(道具){
返回(

);
}
**在这里打电话**
yourrefeshcall=()=>{
}

我们定义标签的地方=(道具)=>{你能为我更新代码吗,这样我就能轻松使用它吗?我们定义标签的地方=(道具)=>{你能为我更新代码吗,这样我就能轻松使用它吗
**its depend on how you used tabbar** 

const Tabs = TabNavigator(
  {
    Tab1: { screen: TabList1 },
    Tab2: { screen: TabList2 },
  },
  {
    initialRouteName: 'Tab1',
    swipeEnabled: true,
    animationEnabled: true,
  },
);

<Tabs
          screenProps={{
            onRefresh: this.yourrefeshcall,
          }}
      />


then 

Tabs = (props) => {
    if (props) {
      return (
        < Tabs
            navigation={props.navigation}
            screenProps={{
              onRefresh: this.yourrefeshcall,

            }}
        />
      );
    }

**make your call here** 

yourrefeshcall=()=>{

}