简体   繁体   English

在反应导航中,如何防止 AppBar 固定在顶部? 我希望它在滚动时消失

[英]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.

相关问题 更改视图时如何防止反应导航为 AppBar 的高度设置动画? - How to prevent react-navigation to animate the height of the AppBar when changing views? 我如何知道我在 react-navigation 5 中的当前路线? - How can I know my current route in react-navigation 5? 如何使用Stack Actions在反应导航中重置路线? - How I can reset route in react-navigation with Stack Actions? 如何在 react-navigation 5 中设置背景颜色 - How can I set the background color in react-navigation 5 我希望我的导航栏在我向下滚动时消失并在我向上滚动时出现。 导航栏是固定的。 怎么了? - I want my navbar to disappear when I scroll down and appear when I scroll up. The navbar is fixed. What is wrong? 我如何知道我是否已经使用选项卡导航(反应导航)离开了屏幕? - How can I know if I leave the screen already with tab navigation (react-navigation)? 滚动时如何保持顶部菜单固定 - How to keep my top menu stay fixed when i scroll react native,react-navigation,TabNavigator,当我更改选项卡屏幕时如何发送请求 - react native, react-navigation, TabNavigator, how to send a request when I change tab screen 我如何在 react-router-dom 中像 react-navigation 一样获得“previous”? - How in react-router-dom can I get the `previous` as in react-navigation? 如何防止浏览器滚动到哈希值更改的顶部? - How can I prevent the browser to scroll to the top on hash change?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM