gpt4 book ai didi

javascript - 在react-navigation中,如何防止AppBar固定在顶部?我希望它在我滚动时消失

转载 作者:行者123 更新时间:2023-12-02 21:58:20 24 4
gpt4 key购买 nike

我正在使用react-navigation 5.x,我希望当我向下滚动时我的AppBar消失。

这就是我的导航的样子:

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>
);
}

在react-navigation中,如何防止AppBar固定在顶部?

最佳答案

使用Animated.diffClamp()正如文档所说:

This is useful with scroll events, for example, to show the navbar when scrolling up and to hide it when scrolling down.

关于javascript - 在react-navigation中,如何防止AppBar固定在顶部?我希望它在我滚动时消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59945501/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com