2
2
3
3
import React , { PureComponent } from 'react' ;
4
4
import { StyleSheet } from 'react-native' ;
5
- import { TabViewAnimated } from 'react-native-tab-view' ;
5
+ import { TabViewAnimated , TabViewPagerPan } from 'react-native-tab-view' ;
6
6
import SceneView from '../SceneView' ;
7
7
import withCachedChildNavigation from '../../withCachedChildNavigation' ;
8
8
@@ -127,6 +127,8 @@ class TabView extends PureComponent<void, Props, void> {
127
127
) ;
128
128
} ;
129
129
130
+ _renderPager = ( props : * ) => < TabViewPagerPan { ...props } /> ;
131
+
130
132
render ( ) {
131
133
const {
132
134
router,
@@ -140,6 +142,7 @@ class TabView extends PureComponent<void, Props, void> {
140
142
141
143
let renderHeader ;
142
144
let renderFooter ;
145
+ let renderPager ;
143
146
144
147
const { state } = this . props . navigation ;
145
148
const options = router . getScreenOptions (
@@ -159,17 +162,22 @@ class TabView extends PureComponent<void, Props, void> {
159
162
}
160
163
}
161
164
165
+ if ( animationEnabled === false && swipeEnabled === false ) {
166
+ renderPager = this . _renderPager ;
167
+ }
168
+
162
169
const props = {
163
- style : styles . container ,
164
- navigationState : this . props . navigation . state ,
165
170
lazy,
166
- renderHeader,
167
- renderFooter,
168
171
animationEnabled,
169
172
swipeEnabled,
173
+ renderPager,
174
+ renderHeader,
175
+ renderFooter,
170
176
renderScene : this . _renderScene ,
171
177
onRequestChangeTab : this . _handlePageChanged ,
178
+ navigationState : this . props . navigation . state ,
172
179
screenProps : this . props . screenProps ,
180
+ style : styles . container ,
173
181
} ;
174
182
175
183
return < TabViewAnimated { ...props } /> ;
0 commit comments