Allow modification of SafeAreaView props (#3496)

* SafeAreaView fix

* Updated to only allow modification of forceInset property of SafeAreaView
This commit is contained in:
Arseny Yankovsky 2018-03-01 22:42:19 +01:00 committed by Brent Vatne
parent 416fe58cab
commit 214eeb13fb
2 changed files with 14 additions and 4 deletions

View File

@ -48,6 +48,15 @@ declare module 'react-navigation' {
// react-native/Libraries/Animated/src/nodes/AnimatedValue.js
declare type AnimatedValue = Object;
declare type HeaderForceInset = {
horizontal?: string,
vertical?: string,
left?: string,
right?: string,
top?: string,
bottom?: string,
};
/**
* Next, all the type declarations
*/
@ -341,6 +350,7 @@ declare module 'react-navigation' {
headerPressColorAndroid?: string,
headerRight?: React$Node,
headerStyle?: ViewStyleProp,
headerForceInset?: HeaderForceInset,
headerBackground?: React$Node | React$ElementType,
gesturesEnabled?: boolean,
gestureResponseDistance?: { vertical?: number, horizontal?: number },

View File

@ -473,11 +473,11 @@ class Header extends React.PureComponent {
safeHeaderStyle,
];
const { headerForceInset } = options;
const forceInset = headerForceInset || { top: 'always', bottom: 'never' };
return (
<SafeAreaView
forceInset={{ top: 'always', bottom: 'never' }}
style={containerStyles}
>
<SafeAreaView forceInset={forceInset} style={containerStyles}>
<View style={StyleSheet.absoluteFill}>{options.headerBackground}</View>
<View style={{ flex: 1 }}>{appBar}</View>
</SafeAreaView>