Fix scroll jump on Back (#2067)

zio/stable
dan 2023-12-01 22:05:10 +00:00 committed by GitHub
parent 9dec9d7276
commit bb22ebd588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -69,13 +69,19 @@ export const PagerWithHeader = React.forwardRef<PagerRef, PagerWithHeaderProps>(
// capture the header bar sizing
const onTabBarLayout = React.useCallback(
(evt: LayoutChangeEvent) => {
setTabBarHeight(evt.nativeEvent.layout.height)
const height = evt.nativeEvent.layout.height
if (height > 0) {
setTabBarHeight(height)
}
},
[setTabBarHeight],
)
const onHeaderOnlyLayout = React.useCallback(
(evt: LayoutChangeEvent) => {
setHeaderOnlyHeight(evt.nativeEvent.layout.height)
const height = evt.nativeEvent.layout.height
if (height > 0) {
setHeaderOnlyHeight(height)
}
},
[setHeaderOnlyHeight],
)