This repository was archived by the owner on Feb 25, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ function createHeaderBackgroundExample(options = {}) {
2121 navigationOptions : {
2222 headerTitle : 'Login Screen' ,
2323 headerTintColor : '#fff' ,
24- headerBackground : (
24+ headerBackground : ( ) => (
2525 < View style = { { flex : 1 , backgroundColor : '#FF0066' } } />
2626 ) ,
2727 } ,
@@ -41,7 +41,7 @@ function createHeaderBackgroundExample(options = {}) {
4141 navigationOptions : {
4242 headerTitle : 'Games Screen' ,
4343 headerTintColor : '#fff' ,
44- headerBackground : (
44+ headerBackground : ( ) => (
4545 < View style = { { flex : 1 , backgroundColor : '#3388FF' } } />
4646 ) ,
4747 } ,
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ describe('StackNavigator', () => {
6464 Home : {
6565 screen : HomeScreen ,
6666 navigationOptions : {
67- headerRight : < View /> ,
67+ headerRight : ( ) => < View /> ,
6868 } ,
6969 } ,
7070 } ) ;
@@ -90,7 +90,7 @@ describe('StackNavigator', () => {
9090
9191 class A extends React . Component {
9292 static navigationOptions = {
93- headerRight : < TestComponentWithNavigation onPress = { spy } /> ,
93+ headerRight : ( ) => < TestComponentWithNavigation onPress = { spy } /> ,
9494 } ;
9595
9696 render ( ) {
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ export type NavigationStackOptions = {
122122 title ?: string | null ;
123123 } ) => React . ReactNode ;
124124 headerPressColorAndroid ?: string ;
125- headerBackground ?: React . ReactNode ;
125+ headerBackground ?: ( ( ) => React . ReactNode ) | React . ReactNode ;
126126 headerTransparent ?: boolean ;
127127 headerStyle ?: StyleProp < ViewStyle > ;
128128 headerForceInset ?: React . ComponentProps < typeof SafeAreaView > [ 'forceInset' ] ;
Original file line number Diff line number Diff line change @@ -440,7 +440,10 @@ class Header extends React.PureComponent<Props, State> {
440440 return this . renderSubView (
441441 { ...props , style : StyleSheet . absoluteFill } ,
442442 'background' ,
443- ( ) => options . headerBackground ,
443+ ( ) =>
444+ typeof options . headerBackground === 'function'
445+ ? options . headerBackground ( )
446+ : options . headerBackground ,
444447 this . props . backgroundInterpolator
445448 ) ;
446449 } ;
You can’t perform that action at this time.
0 commit comments