Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit 123af52

Browse files
committed
feat: add a headerShown option
1 parent 57b7442 commit 123af52

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/types.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export type HeaderTransitionConfig = {
9999
export type NavigationStackOptions = {
100100
title?: string;
101101
header?: ((props: HeaderProps) => React.ReactNode) | null;
102+
headerShown?: boolean;
102103
headerTitle?:
103104
| ((props: TextProps & { children?: string }) => React.ReactNode)
104105
| React.ReactNode;

src/views/Header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ class Header extends React.PureComponent<Props, State> {
562562

563563
private renderHeader = (props: SubviewProps) => {
564564
const { options } = props.scene.descriptor;
565-
if (options.header === null) {
565+
if (options.header === null || options.headerShown === false) {
566566
return null;
567567
}
568568
const left = this.renderLeft(props);

src/views/StackView/StackViewLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ class StackViewLayout extends React.Component<Props, State> {
194194

195195
private renderHeader(scene: Scene, headerMode: HeaderMode) {
196196
const { options } = scene.descriptor;
197-
const { header } = options;
197+
const { header, headerShown } = options;
198198

199199
if (__DEV__ && typeof header === 'string') {
200200
throw new Error(
201201
`Invalid header value: "${header}". The header option must be a valid React component or null, not a string.`
202202
);
203203
}
204204

205-
if (header === null && headerMode === 'screen') {
205+
if ((header === null || headerShown === false) && headerMode === 'screen') {
206206
return null;
207207
}
208208

0 commit comments

Comments
 (0)