@@ -25,6 +25,9 @@ type Config = {
2525 initialLayout ?: { width ?: number ; height ?: number } ;
2626 lazy ?: boolean ;
2727 lazyPlaceholderComponent ?: React . ComponentType < { route : Route } > ;
28+ pagerComponent ?: React . ComponentType <
29+ Parameters < React . ComponentProps < typeof TabView > [ 'renderPager' ] > [ 0 ]
30+ > ;
2831 tabBarComponent ?: React . ComponentType < any > ;
2932 tabBarOptions ?: MaterialTabBarOptions ;
3033 tabBarPosition ?: 'top' | 'bottom' ;
@@ -42,17 +45,7 @@ type Props = NavigationViewProps &
4245 } ;
4346
4447class MaterialTabView extends React . PureComponent < Props > {
45- _renderLazyPlaceholder = ( props : { route : Route } ) => {
46- const { lazyPlaceholderComponent : LazyPlaceholder } = this . props ;
47-
48- if ( LazyPlaceholder != null ) {
49- return < LazyPlaceholder { ...props } /> ;
50- }
51-
52- return null ;
53- } ;
54-
55- _renderTabBar = ( props : SceneRendererProps ) => {
48+ private renderTabBar = ( props : SceneRendererProps ) => {
5649 const { state } = this . props . navigation ;
5750 const route = state . routes [ state . index ] ;
5851 const { descriptors } = this . props ;
@@ -107,10 +100,11 @@ class MaterialTabView extends React.PureComponent<Props> {
107100 onTabPress,
108101 onTabLongPress,
109102 screenProps,
110- lazyPlaceholderComponent,
111103 tabBarComponent,
112104 tabBarOptions,
113105 /* eslint-enable @typescript-eslint/no-unused-vars */
106+ lazyPlaceholderComponent,
107+ pagerComponent,
114108 navigation,
115109 descriptors,
116110 ...rest
@@ -137,8 +131,17 @@ class MaterialTabView extends React.PureComponent<Props> {
137131 { ...rest }
138132 navigationState = { navigation . state }
139133 swipeEnabled = { swipeEnabled }
140- renderTabBar = { this . _renderTabBar }
141- renderLazyPlaceholder = { this . _renderLazyPlaceholder }
134+ renderTabBar = { this . renderTabBar }
135+ renderLazyPlaceholder = {
136+ lazyPlaceholderComponent !== undefined
137+ ? props => React . createElement ( lazyPlaceholderComponent , props )
138+ : undefined
139+ }
140+ renderPager = {
141+ pagerComponent !== undefined
142+ ? props => React . createElement ( pagerComponent , props )
143+ : undefined
144+ }
142145 />
143146 ) ;
144147 }
0 commit comments