gpt4 book ai didi

javascript - react 导航选项卡导航器中的淡入淡出动画

转载 作者:数据小太阳 更新时间:2023-10-29 05:35:01 27 4
gpt4 key购买 nike

我正在使用 React Navigation 选项卡导航器和 React Native Material 底部导航,它目前在屏幕之间滑动。我如何让它像 Material Design Guidelines 所建议的那样从一个屏幕淡入淡出到另一个屏幕。

Router.js

import React from 'react';
import { TabNavigator, StackNavigator, NavigationActions } from 'react-navigation';
import { NavigationComponent } from 'react-native-material-bottom-navigation';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { MAIN_COLOR, BOTTOM_BAR_COLOR, BOTTOM_BAR_ICON_COLOR } from '../config';
import { Classes, Settings, Search, SplashScreen } from '../components/screens';
import Login from '../components/screens/Login';
import Main from '../Main';

export const Tabs = TabNavigator({
Classes: {
screen: Classes,
navigationOptions: {
tabBarLabel: 'Classes',
tabBarIcon: () => <Icon size={24} name="list" color={BOTTOM_BAR_ICON_COLOR} />,
},
},
Search: {
screen: Search,
navigationOptions: {
tabBarLabel: 'Search',
tabBarIcon: () => <Icon size={24} name="search" color={BOTTOM_BAR_ICON_COLOR} />,
},
},
Settings: {
screen: Settings,
navigationOptions: {
tabBarLabel: 'Settings',
tabBarIcon: () => <Icon size={24} name="settings" color={BOTTOM_BAR_ICON_COLOR} />,
},
},
}, {
tabBarComponent: NavigationComponent,
tabBarPosition: 'bottom',
swipeEnabled: false,
tabBarOptions: {
bottomNavigationOptions: {
labelColor: BOTTOM_BAR_ICON_COLOR,
rippleColor: MAIN_COLOR,
shifting: false,
tabs: {
Search: {
barBackgroundColor: BOTTOM_BAR_COLOR,
activeIcon: <Icon size={24} name="search" color={MAIN_COLOR} />,
activeLabelColor: MAIN_COLOR,
},
Classes: {
barBackgroundColor: BOTTOM_BAR_COLOR,
activeIcon: <Icon size={24} name="list" color={MAIN_COLOR} />,
activeLabelColor: MAIN_COLOR,
},
Settings: {
barBackgroundColor: BOTTOM_BAR_COLOR,
activeIcon: <Icon size={24} name="settings" color={MAIN_COLOR} />,
activeLabelColor: MAIN_COLOR,
},
},
},
},
});

这就是我想要的效果

https://storage.googleapis.com/material-design/publish/material_v_11/assets/0B3321sZLoP_HTTA0QUM4MWxKSTg/components_bottomnavigation_behavior_crossfade.webm

这就是我的

https://storage.googleapis.com/material-design/publish/material_v_11/assets/0B3321sZLoP_HQWYxQWE5LUg2WDQ/components_bottomnavigation_behavior_sibling.webm

最佳答案

我最终通过在选项卡导航器中禁用动画来修复错误。

关于javascript - react 导航选项卡导航器中的淡入淡出动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45584695/

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