react-native - 自定义标签栏而不是反应导航
问题描述
可以在 react native 中创建我自己的导航标签栏而不是使用 react 导航。我想从头开始创建一些东西,所以我不必学习反应导航技术。
解决方案
正如 Michael Bahl 已经指出的那样,在软件开发中使用框架可以让您在更短的时间内获得更多功能。如果你足够幸运,你甚至会得到一个经过良好测试的。
话虽如此,反应导航提供了轻松自定义某些导航元素的能力。
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
const Tab = createBottomTabNavigator();
const CustomTabNavigator = () => {
return (
<Tab.Navigator
initialRouteName="HomeTab"
screenOptions={{headerShown: false, tabBarShowLabel: false}}>
<Tab.Screen
name="NavigationTab"
component={MyScreen}
options={{
tabBarIcon: ({color}) => <TabBarIcon name="compass" color={color} />,
}}
/>
</Tab.Navigator>
);
};
export default CustomTabNavigator;
Material Top Tabs和更多导航器也是如此,它们甚至提供了用于自定义的API。:-)
推荐阅读
- node.js - Local images no loading on React
- f# - How to make FSI work under NET5 and make stupid stackoverflow message "Title cannot contain ..." shut up?
- scilab - Embedding an fsolve into an ODE as opposed to using DAE solver in Scilab
- c# - .Net 5 - WPF, unit test woes
- sql - Why does Case written this way bring a 'ghost' row in my table?
- mysql - oredr by desc not working on order by clause after using extract inside order by
- kubernetes - How can I get CoreDNS to resolve on my Raspberry Pi Kubernetes cluster?
- arrays - C# How to save multiple images asynchronously from a a list of Task
using FileStream. (WinForms) - r - 根据多个条件删除组上的行 r
- microsoft-graph-api - 在 MS 的示例应用程序中创建 GraphServiceClient 时出错