make NavigationHeader and NavigationHeaderTitle pointerEvents configurable

Summary:I basically want to build a transparent NavigationHeader, so I need to be able to set the pointerEvents of the NavigationHeader.
Closes https://github.com/facebook/react-native/pull/6881

Differential Revision: D3168620

Pulled By: ericvicenti

fb-gh-sync-id: 679f3f5858142f468be329771ea281c31e1f0d40
fbshipit-source-id: 679f3f5858142f468be329771ea281c31e1f0d40
This commit is contained in:
Martin Rädlinger 2016-04-12 10:54:47 -07:00 committed by Facebook Github Bot 1
parent d403ac6a31
commit 8a7eceeb4f
2 changed files with 7 additions and 4 deletions

View File

@ -65,6 +65,7 @@ type Props = NavigationSceneRendererProps & {
renderRightComponent: NavigationSceneRenderer,
renderTitleComponent: NavigationSceneRenderer,
style?: any;
viewProps?: any;
};
type SubViewName = 'left' | 'title' | 'right';
@ -99,6 +100,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
renderRightComponent: PropTypes.func,
renderTitleComponent: PropTypes.func,
style: View.propTypes.style,
viewProps: PropTypes.shape(View.propTypes),
};
shouldComponentUpdate(nextProps: Props, nextState: any): boolean {
@ -110,7 +112,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
}
render(): ReactElement {
const { scenes, style } = this.props;
const { scenes, style, viewProps } = this.props;
const scenesProps = scenes.map(scene => {
const props = NavigationPropTypes.extractSceneRendererProps(this.props);
@ -119,7 +121,7 @@ class NavigationHeader extends React.Component<DefaultProps, Props, any> {
});
return (
<View style={[ styles.appbar, style ]}>
<View style={[ styles.appbar, style ]} {...viewProps}>
{scenesProps.map(this._renderLeft, this)}
{scenesProps.map(this._renderTitle, this)}
{scenesProps.map(this._renderRight, this)}

View File

@ -41,10 +41,11 @@ type Props = {
children: ReactElement;
style: any;
textStyle: any;
viewProps: any;
}
const NavigationHeaderTitle = ({ children, style, textStyle }: Props) => (
<View style={[ styles.title, style ]}>
const NavigationHeaderTitle = ({ children, style, textStyle, viewProps }: Props) => (
<View style={[ styles.title, style ]} {...viewProps}>
<Text style={[ styles.titleText, textStyle ]}>{children}</Text>
</View>
);