fix: provide navigation prop in header

This commit is contained in:
satyajit.happy
2019-09-22 01:05:17 +02:00
parent ed4bc26aa1
commit b95c4321dd

View File

@@ -1,6 +1,6 @@
import * as React from 'react';
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
import { NavigationRoute } from 'react-navigation';
import { NavigationContext, NavigationRoute } from 'react-navigation';
import {
Layout,
HeaderScene,
@@ -88,36 +88,40 @@ export default function HeaderContainer({
};
return (
<View
<NavigationContext.Provider
key={scene.route.key}
onLayout={
onContentHeightChange
? e =>
onContentHeightChange({
route: scene.route,
height: e.nativeEvent.layout.height,
})
: undefined
}
pointerEvents="box-none"
accessibilityElementsHidden={!isFocused}
importantForAccessibility={
isFocused ? 'auto' : 'no-hide-descendants'
}
style={
mode === 'float' || options.headerTransparent
? styles.header
: null
}
value={scene.descriptor.navigation}
>
{options.header !== undefined ? (
options.header === null ? null : (
options.header(props)
)
) : (
<Header {...props} />
)}
</View>
<View
onLayout={
onContentHeightChange
? e =>
onContentHeightChange({
route: scene.route,
height: e.nativeEvent.layout.height,
})
: undefined
}
pointerEvents="box-none"
accessibilityElementsHidden={!isFocused}
importantForAccessibility={
isFocused ? 'auto' : 'no-hide-descendants'
}
style={
mode === 'float' || options.headerTransparent
? styles.header
: null
}
>
{options.header !== undefined ? (
options.header === null ? null : (
options.header(props)
)
) : (
<Header {...props} />
)}
</View>
</NavigationContext.Provider>
);
})}
</View>