Skip to content

Commit 6aad814

Browse files
committed
docs: updated docs for absolutely-positioned headers
1 parent 1816333 commit 6aad814

File tree

5 files changed

+97
-53
lines changed

5 files changed

+97
-53
lines changed

docs/docs/03-api-reference/01-scroll-view-with-headers.mdx

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ description: A ScrollView that uses React Native Header for better headers.
88
Component that extends the [ScrollView](https://reactnative.dev/docs/scrollview) to add support for
99
headers exported from this library.
1010

11-
The implementation of this component relies on the [HeaderComponent](/docs/components/scroll-view-with-headers#headercomponent)
11+
The implementation of this component relies on the [HeaderComponent](/docs/components/scroll-view-with-headers#headercomponent)
1212
and [LargeHeaderComponent](/docs/components/scroll-view-with-headers#largeheadercomponent) props.
13-
The [HeaderComponent](/docs/components/scroll-view-with-headers#headercomponent) is rendered above
14-
the ScrollView and the [LargeHeaderComponent](/docs/components/scroll-view-with-headers#largeheadercomponent)
15-
is rendered as the first child of the ScrollView. Using these two props will allow for animations/built-in
13+
The [HeaderComponent](/docs/components/scroll-view-with-headers#headercomponent) is rendered above
14+
the ScrollView and the [LargeHeaderComponent](/docs/components/scroll-view-with-headers#largeheadercomponent)
15+
is rendered as the first child of the ScrollView. Using these two props will allow for animations/built-in
1616
features in this library to work properly.
1717

1818
## Props
1919

20-
This component uses the `Animated.ScrollView` under the hood, which inherits [all of the props
21-
from the ScrollView](https://reactnative.dev/docs/scrollview) component.
20+
This component uses the `Animated.ScrollView` under the hood, which inherits [all of the props
21+
from the ScrollView](https://reactnative.dev/docs/scrollview) component.
2222

2323
### HeaderComponent
2424

2525
The component to render above the ScrollView. This accepts a function that returns a React Element
2626
to display as the header. The function will be called with the following arguments:
2727

2828
- `showNavBar`: An animated value that will be 0 when the header's subcomponents should be hidden
29-
and 1 when they should be shown. This is useful for animating the header's subcomponents. The
30-
[Header](/docs/components/header) component uses this value to animate its left, center, and
29+
and 1 when they should be shown. This is useful for animating the header's subcomponents. The
30+
[Header](/docs/components/header) component uses this value to animate its left, center, and
3131
right children.
3232

3333
### LargeHeaderComponent
@@ -37,19 +37,18 @@ returns a React Element to display as the large header. The function will be cal
3737
following arguments:
3838

3939
- `scrollY`: An animated value that keeps track of the current scroll position of the ScrollView.
40-
This prop is useful for creating custom animations on the large header. In our [example](/docs/example),
41-
we use the [ScalingView](/docs/components/scaling-view) component to scale the large header
40+
This prop is useful for creating custom animations on the large header. In our [example](/docs/example),
41+
we use the [ScalingView](/docs/components/scaling-view) component to scale the large header
4242
when the user pulls down on the ScrollView (to mimic native iOS behaviour).
43-
4443
- `showNavBar`: An animated value that keeps track of whether or not the small header is hidden.
4544
This prop is useful if you want to create your own custom animations based on whether or not the
4645
small header is hidden.
4746

4847
### ignoreLeftSafeArea
4948

50-
An optional boolean that determines whether or not to ignore the left safe area. Defaults to
51-
`false`. The safe area adjustments are used to make sure that the scroll container does not
52-
overlap with the notch/headers on different phones - leave this prop as false if you want to
49+
An optional boolean that determines whether or not to ignore the left safe area. Defaults to
50+
`false`. The safe area adjustments are used to make sure that the scroll container does not
51+
overlap with the notch/headers on different phones - leave this prop as false if you want to
5352
respect those safe areas.
5453

5554
### ignoreRightSafeArea
@@ -61,7 +60,7 @@ respect those safe areas.
6160

6261
### disableAutoFixScroll
6362

64-
An optional to disable the auto fix scroll mechanism. This is useful if you want to disable the
63+
An optional to disable the auto fix scroll mechanism. This is useful if you want to disable the
6564
auto scroll when the large header is partially visible. Defaults to `false`.
6665

6766
### containerStyle
@@ -74,11 +73,22 @@ An optional style object that will be applied to the large header container.
7473

7574
### largeHeaderShown
7675

77-
An optional animated [Shared Value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/)
78-
that will be mutated by the library when the large header is shown or hidden. This is useful if you
76+
An optional animated [Shared Value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/)
77+
that will be mutated by the library when the large header is shown or hidden. This is useful if you
7978
would like to track when the large header is shown or hidden.
8079

8180
### onLargeHeaderLayout
8281

8382
An optional callback that will be called when the large header is laid out. This is useful if you
8483
want to access the layout of the large header to calculate the height of the large header.
84+
85+
### absoluteHeader
86+
87+
This property controls whether or not the header component is absolutely positioned. This is useful
88+
if you want to render a header component that allows for transparency.
89+
90+
### initialAbsoluteHeaderHeight
91+
92+
This property is used when `absoluteHeader` is true. This is the initial height of the
93+
absolute header. Since the header's height is computed on its layout event, this is used
94+
to set the initial height of the header so that it doesn't jump when it is initially rendered.

docs/docs/03-api-reference/02-flat-list-with-headers.mdx

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,47 @@ description: A FlatList that uses React Native Header for better headers.
88
Component that extends the [FlatList](https://reactnative.dev/docs/flatlist) to add support for
99
headers exported from this library.
1010

11-
The implementation of this component relies on the [HeaderComponent](/docs/components/flat-list-with-headers#headercomponent)
11+
The implementation of this component relies on the [HeaderComponent](/docs/components/flat-list-with-headers#headercomponent)
1212
and [LargeHeaderComponent](/docs/components/flat-list-with-headers#largeheadercomponent) props.
13-
The [HeaderComponent](/docs/components/flat-list-with-headers#headercomponent) is rendered above
14-
the FlatList and the [LargeHeaderComponent](/docs/components/flat-list-with-headers#largeheadercomponent)
15-
is rendered as the `ListHeaderComponent` of the FlatList. Using these two props will allow for
13+
The [HeaderComponent](/docs/components/flat-list-with-headers#headercomponent) is rendered above
14+
the FlatList and the [LargeHeaderComponent](/docs/components/flat-list-with-headers#largeheadercomponent)
15+
is rendered as the `ListHeaderComponent` of the FlatList. Using these two props will allow for
1616
animations/built-in features in this library to work properly.
1717

1818
## Props
1919

20-
This component uses the `Animated.FlatList` under the hood, which inherits [all of the props
21-
from the FlatList](https://reactnative.dev/docs/flatlist) component.
20+
This component uses the `Animated.FlatList` under the hood, which inherits [all of the props
21+
from the FlatList](https://reactnative.dev/docs/flatlist) component.
2222

2323
### HeaderComponent
2424

2525
The component to render above the FlatList. This accepts a function that returns a React Element
2626
to display as the header. The function will be called with the following arguments:
2727

2828
- `showNavBar`: An animated value that will be 0 when the header's subcomponents should be hidden
29-
and 1 when they should be shown. This is useful for animating the header's subcomponents. The
30-
[Header](/docs/components/header) component uses this value to animate its left, center, and
29+
and 1 when they should be shown. This is useful for animating the header's subcomponents. The
30+
[Header](/docs/components/header) component uses this value to animate its left, center, and
3131
right children.
3232

3333
### LargeHeaderComponent
3434

35-
An optional component to render as the large header for this component. This accepts a function
35+
An optional component to render as the large header for this component. This accepts a function
3636
that returns a React Element to display as the large header. The function will be called with the
3737
following arguments:
3838

3939
- `scrollY`: An animated value that keeps track of the current scroll position of the FlatList.
40-
This prop is useful for creating custom animations on the large header. In our [example](/docs/example),
41-
we use the [ScalingView](/docs/components/scaling-view) component to scale the large header
40+
This prop is useful for creating custom animations on the large header. In our [example](/docs/example),
41+
we use the [ScalingView](/docs/components/scaling-view) component to scale the large header
4242
when the user pulls down on the FlatList (to mimic native iOS behaviour).
43-
4443
- `showNavBar`: An animated value that keeps track of whether or not the small header is hidden.
4544
This prop is useful if you want to create your own custom animations based on whether or not the
4645
small header is hidden.
4746

4847
### ignoreLeftSafeArea
4948

50-
An optional boolean that determines whether or not to ignore the left safe area. Defaults to
51-
`false`. The safe area adjustments are used to make sure that the scroll container does not
52-
overlap with the notch/headers on different phones - leave this prop as false if you want to
49+
An optional boolean that determines whether or not to ignore the left safe area. Defaults to
50+
`false`. The safe area adjustments are used to make sure that the scroll container does not
51+
overlap with the notch/headers on different phones - leave this prop as false if you want to
5352
respect those safe areas.
5453

5554
### ignoreRightSafeArea
@@ -61,7 +60,7 @@ respect those safe areas.
6160

6261
### disableAutoFixScroll
6362

64-
An optional to disable the auto fix scroll mechanism. This is useful if you want to disable the
63+
An optional to disable the auto fix scroll mechanism. This is useful if you want to disable the
6564
auto scroll when the large header is partially visible. Defaults to `false`.
6665

6766
### containerStyle
@@ -74,11 +73,22 @@ An optional style object that will be applied to the large header container.
7473

7574
### largeHeaderShown
7675

77-
An optional animated [Shared Value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/)
78-
that will be mutated by the library when the large header is shown or hidden. This is useful if you
76+
An optional animated [Shared Value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/)
77+
that will be mutated by the library when the large header is shown or hidden. This is useful if you
7978
would like to track when the large header is shown or hidden.
8079

8180
### onLargeHeaderLayout
8281

8382
An optional callback that will be called when the large header is laid out. This is useful if you
8483
want to access the layout of the large header to calculate the height of the large header.
84+
85+
### absoluteHeader
86+
87+
This property controls whether or not the header component is absolutely positioned. This is useful
88+
if you want to render a header component that allows for transparency.
89+
90+
### initialAbsoluteHeaderHeight
91+
92+
This property is used when `absoluteHeader` is true. This is the initial height of the
93+
absolute header. Since the header's height is computed on its layout event, this is used
94+
to set the initial height of the header so that it doesn't jump when it is initially rendered.

docs/docs/03-api-reference/03-section-list-with-headers.mdx

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,47 @@ description: A SectionList that uses React Native Header for better headers.
88
Component that extends the [SectionList](https://reactnative.dev/docs/sectionlist) to add support for
99
headers exported from this library.
1010

11-
The implementation of this component relies on the [HeaderComponent](/docs/components/section-list-with-headers#headercomponent)
11+
The implementation of this component relies on the [HeaderComponent](/docs/components/section-list-with-headers#headercomponent)
1212
and [LargeHeaderComponent](/docs/components/section-list-with-headers#largeheadercomponent) props.
13-
The [HeaderComponent](/docs/components/section-list-with-headers#headercomponent) is rendered above
14-
the SectionList and the [LargeHeaderComponent](/docs/components/section-list-with-headers#largeheadercomponent)
15-
is rendered as the `ListHeaderComponent` of the SectionList. Using these two props will allow for
13+
The [HeaderComponent](/docs/components/section-list-with-headers#headercomponent) is rendered above
14+
the SectionList and the [LargeHeaderComponent](/docs/components/section-list-with-headers#largeheadercomponent)
15+
is rendered as the `ListHeaderComponent` of the SectionList. Using these two props will allow for
1616
animations/built-in features in this library to work properly.
1717

1818
## Props
1919

20-
This component uses the SectionList under the hood, which inherits [all of the props
21-
from the SectionList](https://reactnative.dev/docs/sectionlist) component.
20+
This component uses the SectionList under the hood, which inherits [all of the props
21+
from the SectionList](https://reactnative.dev/docs/sectionlist) component.
2222

2323
### HeaderComponent
2424

2525
The component to render above the SectionList. This accepts a function that returns a React Element
2626
to display as the header. The function will be called with the following arguments:
2727

2828
- `showNavBar`: An animated value that will be 0 when the header's subcomponents should be hidden
29-
and 1 when they should be shown. This is useful for animating the header's subcomponents. The
30-
[Header](/docs/components/header) component uses this value to animate its left, center, and
29+
and 1 when they should be shown. This is useful for animating the header's subcomponents. The
30+
[Header](/docs/components/header) component uses this value to animate its left, center, and
3131
right children.
3232

3333
### LargeHeaderComponent
3434

35-
An optional component to render as the large header for this component. This accepts a function
35+
An optional component to render as the large header for this component. This accepts a function
3636
that returns a React Element to display as the large header. The function will be called with the
3737
following arguments:
3838

3939
- `scrollY`: An animated value that keeps track of the current scroll position of the SectionList.
40-
This prop is useful for creating custom animations on the large header. In our [example](/docs/example),
41-
we use the [ScalingView](/docs/components/scaling-view) component to scale the large header
40+
This prop is useful for creating custom animations on the large header. In our [example](/docs/example),
41+
we use the [ScalingView](/docs/components/scaling-view) component to scale the large header
4242
when the user pulls down on the SectionList (to mimic native iOS behaviour).
43-
4443
- `showNavBar`: An animated value that keeps track of whether or not the small header is hidden.
4544
This prop is useful if you want to create your own custom animations based on whether or not the
4645
small header is hidden.
4746

4847
### ignoreLeftSafeArea
4948

50-
An optional boolean that determines whether or not to ignore the left safe area. Defaults to
51-
`false`. The safe area adjustments are used to make sure that the scroll container does not
52-
overlap with the notch/headers on different phones - leave this prop as false if you want to
49+
An optional boolean that determines whether or not to ignore the left safe area. Defaults to
50+
`false`. The safe area adjustments are used to make sure that the scroll container does not
51+
overlap with the notch/headers on different phones - leave this prop as false if you want to
5352
respect those safe areas.
5453

5554
### ignoreRightSafeArea
@@ -61,7 +60,7 @@ respect those safe areas.
6160

6261
### disableAutoFixScroll
6362

64-
An optional to disable the auto fix scroll mechanism. This is useful if you want to disable the
63+
An optional to disable the auto fix scroll mechanism. This is useful if you want to disable the
6564
auto scroll when the large header is partially visible. Defaults to `false`.
6665

6766
### containerStyle
@@ -74,11 +73,22 @@ An optional style object that will be applied to the large header container.
7473

7574
### largeHeaderShown
7675

77-
An optional animated [Shared Value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/)
78-
that will be mutated by the library when the large header is shown or hidden. This is useful if you
76+
An optional animated [Shared Value](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/)
77+
that will be mutated by the library when the large header is shown or hidden. This is useful if you
7978
would like to track when the large header is shown or hidden.
8079

8180
### onLargeHeaderLayout
8281

8382
An optional callback that will be called when the large header is laid out. This is useful if you
8483
want to access the layout of the large header to calculate the height of the large header.
84+
85+
### absoluteHeader
86+
87+
This property controls whether or not the header component is absolutely positioned. This is useful
88+
if you want to render a header component that allows for transparency.
89+
90+
### initialAbsoluteHeaderHeight
91+
92+
This property is used when `absoluteHeader` is true. This is the initial height of the
93+
absolute header. Since the header's height is computed on its layout event, this is used
94+
to set the initial height of the header so that it doesn't jump when it is initially rendered.

docs/docs/03-api-reference/04-flash-list-with-headers.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,14 @@ would like to track when the large header is shown or hidden.
8686

8787
An optional callback that will be called when the large header is laid out. This is useful if you
8888
want to access the layout of the large header to calculate the height of the large header.
89+
90+
### absoluteHeader
91+
92+
This property controls whether or not the header component is absolutely positioned. This is useful
93+
if you want to render a header component that allows for transparency.
94+
95+
### initialAbsoluteHeaderHeight
96+
97+
This property is used when `absoluteHeader` is true. This is the initial height of the
98+
absolute header. Since the header's height is computed on its layout event, this is used
99+
to set the initial height of the header so that it doesn't jump when it is initially rendered.

docs/docs/03-api-reference/05-header.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ An animated value between 0 and 1 that indicates whether the header's children s
1919

2020
An optional style object to apply to the header's root container.
2121

22+
NOTE: Do not apply an `absolute` position to this container. Instead, use the `absoluteHeader` prop
23+
on any of the scroll containers to absolutely position the header.
24+
2225
### headerLeft
2326

2427
An optional React element to display on the left side of the header.

0 commit comments

Comments
 (0)