@@ -10,6 +10,7 @@ import BottomTabBar, { type TabBarOptions } from '../views/BottomTabBar';
10
10
import ResourceSavingScene from '../views/ResourceSavingScene' ;
11
11
12
12
type Props = InjectedProps & {
13
+ lazy ?: boolean ,
13
14
tabBarComponent ?: React . ComponentType < * > ,
14
15
tabBarOptions ?: TabBarOptions ,
15
16
} ;
@@ -19,6 +20,10 @@ type State = {
19
20
} ;
20
21
21
22
class TabNavigationView extends React . PureComponent < Props , State > {
23
+ static defaultProps = {
24
+ lazy : true ,
25
+ } ;
26
+
22
27
static getDerivedStateFromProps ( nextProps , prevState ) {
23
28
const { index } = nextProps . navigation . state ;
24
29
@@ -87,15 +92,15 @@ class TabNavigationView extends React.PureComponent<Props, State> {
87
92
} ;
88
93
89
94
render ( ) {
90
- const { navigation, renderScene } = this . props ;
95
+ const { navigation, renderScene, lazy } = this . props ;
91
96
const { routes } = navigation . state ;
92
97
const { loaded } = this . state ;
93
98
94
99
return (
95
100
< View style = { styles . container } >
96
101
< View style = { styles . pages } >
97
102
{ routes . map ( ( route , index ) => {
98
- if ( ! loaded . includes ( index ) ) {
103
+ if ( lazy && ! loaded . includes ( index ) ) {
99
104
// Don't render a screen if we've never navigated to it
100
105
return null ;
101
106
}
0 commit comments