标签屏幕从底部弹出

时间:2019-01-24 09:47:28

标签: react-native react-navigation

有人知道如何解决从底部向上滑动的标签屏幕吗?

每个选项卡屏幕都在其自己的Stack Navigator中:

export const Tabs = createBottomTabNavigator(
    {
        Home: {
            screen: HomeStack
        },
        Profile: {
            screen: ProfileStack
        }
    },
    {
        defaultNavigationOptions: ({ navigation }) => ({
            tabBarIcon: ({ focused }) => {
                const { routeName } = navigation.state;

                var tabImage = null;

                if (routeName == "Home") {
                    tabImage = require("../../../assets/icons/my-story.png");
                } else if (routeName == "Profile") {
                    tabImage = require("../../../assets/icons/my-plan.png");
                }

                return <Image source={tabImage} style={focused ? null : { opacity: 0.8 }} />;
            }
        }),
        animationEnabled: false
    }
);

然后根据React Navigation文档设置堆栈:

export const HomeStack = createStackNavigator(
    {
        Home: Home
    }
);

屏幕被延迟加载后从底部弹出。首次加载时,它们会逐渐消失:

enter image description here

1 个答案:

答案 0 :(得分:0)

对于遇到此问题的任何人,我都可以通过安装React Native Screens来解决它

https://github.com/kmagiera/react-native-screens