我在应用程序中使用选项卡导航,但当它加载时,所有内容都同时运行。我想单独运行,例如当我点击一个选项卡时,它调用componentWillMount。
延迟加载不起作用。
const HomeNavigator = TabNavigator( {
Component1: {
screen: Component1
},
Component2: {
screen: Component2
},
Component3: {
screen: Component3
}},{
tabBarPosition: "bottom",
lazy: true,
tabBarOptions: {
activeTintColor: "#e91e63"
},
initialRouteName: "Account",
tabBarComponent: props => {
return <UserFooter navigation={props.navigation} />;
} });
版本号 "react": "16.2.0", "react-native": "0.52.0",