[英]in react-navigation, how can I prevent the AppBar to be fixed top ? I want it to disappear when I scroll
I am working with react-navigation 5.x and I want my AppBar to disappear when I scroll down.我正在使用 react-navigation 5.x,当我向下滚动时,我希望我的 AppBar 消失。
This is how my navigation looks like:这是我的导航的样子:
import React from 'react';
import { createDrawerNavigator } from '@react-navigation/drawer';
export default function createAppContainer(AppNavigator) {
const { Navigator, Screen } = createDrawerNavigator();
// eslint-disable-next-line react/prop-types
return ({ AppBar, DrawerContent, ...rest }) => (
<Navigator drawerContent={DrawerContent}>
<Screen
name="inner-drawer"
component={(props) => (
<AppNavigator
headerMode="screen"
screenOptions={AppBar ? {
header: AppBar,
} : undefined}
{...props}
/>
)}
{...rest}
/>
</Navigator>
);
}
In react-navigation, how can I prevent the AppBar to be fixed top?在 react-navigation 中,如何防止 AppBar 固定在顶部?
UseAnimated.diffClamp() as the documentation said:使用Animated.diffClamp()作为文档说:
This is useful with scroll events, for example, to show the navbar when scrolling up and to hide it when scrolling down.
这对于滚动事件很有用,例如,在向上滚动时显示导航栏并在向下滚动时隐藏它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.