@@ -10,8 +10,10 @@ import {
10
10
type DimensionValue ,
11
11
Image ,
12
12
Platform ,
13
+ type StyleProp ,
13
14
StyleSheet ,
14
15
View ,
16
+ type ViewStyle ,
15
17
processColor ,
16
18
} from 'react-native' ;
17
19
import { BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext' ;
@@ -139,6 +141,11 @@ interface Props<Route extends BaseRoute> {
139
141
*/
140
142
getFreezeOnBlur ?: ( props : { route : Route } ) => boolean | undefined ;
141
143
144
+ /**
145
+ * Get style for the scene, uses `route.style` by default.
146
+ */
147
+ getSceneStyle ?: ( props : { route : Route } ) => StyleProp < ViewStyle > ;
148
+
142
149
tabBarStyle ?: {
143
150
/**
144
151
* Background color of the tab bar.
@@ -196,6 +203,7 @@ const TabView = <Route extends BaseRoute>({
196
203
getActiveTintColor = ( { route } : { route : Route } ) => route . activeTintColor ,
197
204
getTestID = ( { route } : { route : Route } ) => route . testID ,
198
205
getRole = ( { route } : { route : Route } ) => route . role ,
206
+ getSceneStyle = ( { route } : { route : Route } ) => route . style ,
199
207
hapticFeedbackEnabled = false ,
200
208
// Android's native behavior is to show labels when there are less than 4 tabs. We leave it as undefined to use the platform default behavior.
201
209
labeled = Platform . OS !== 'android' ? true : undefined ,
@@ -374,12 +382,15 @@ const TabView = <Route extends BaseRoute>({
374
382
const focused = route . key === focusedKey ;
375
383
const freeze = ! focused ? getFreezeOnBlur ( { route } ) : false ;
376
384
385
+ const customStyle = getSceneStyle ( { route } ) ;
386
+
377
387
return (
378
388
< View
379
389
key = { route . key }
380
390
style = { [
381
391
styles . screen ,
382
392
renderCustomTabBar ? styles . fullWidth : measuredDimensions ,
393
+ customStyle ,
383
394
] }
384
395
collapsable = { false }
385
396
pointerEvents = { focused ? 'auto' : 'none' }
0 commit comments