在react-navigation v3中,createMaterialTopTabNavigator
具有lazy
选项,在react-navigation v4中,它仍然可用,但不起作用,根据github帐户上的reply,似乎只能在react-navigation v5上再次使用。
现在有人可以在react-navigation-tabs上启用延迟加载吗?
const CTabs = createMaterialTopTabNavigator(BTabs, {
// Default config for all screens',
initialRouteName: AScreen',
tabBarComponent: Header,
swipeEnabled: false,
lazy: true,
backBehavior: 'initialRoute',
});
package.json
"react-native": "0.60.4",
"react": "16.8.6",
"react-native-reanimated": "1.2.0",
"react-native-gesture-handler": "1.4.1",
"react-navigation": "4.0.5",
"react-navigation-tabs": "2.5.3",
"react-native-screens": "^2.0.0-alpha.3",
答案 0 :(得分:0)
use this link我在那里写了完整的代码
lazy={true}
optimizationsEnabled={true}
tabBarOptions={tabBarOptions}