Skip to content
Permalink
Browse files

Allow modification of SafeAreaView props (#3496)

* SafeAreaView fix

* Updated to only allow modification of forceInset property of SafeAreaView
  • Loading branch information...
ArsenyYankovsky authored and brentvatne committed Mar 1, 2018
1 parent 403af82 commit f4fe588e083415aaa99629e4c2239873a022a318
Showing with 14 additions and 4 deletions.
  1. +10 −0 flow/react-navigation.js
  2. +4 −4 src/views/Header/Header.js
@@ -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
*/
@@ -340,6 +349,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 },
@@ -476,11 +476,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>

0 comments on commit f4fe588

Please sign in to comment.
You can’t perform that action at this time.