UNPKG

@bottom-tabs/react-navigation

Version:
102 lines (101 loc) 2.49 kB
"use strict"; import { CommonActions } from '@react-navigation/native'; import TabView from 'react-native-bottom-tabs'; import { jsx as _jsx } from "react/jsx-runtime"; export default function NativeBottomTabView({ state, navigation, descriptors, tabBar, ...rest }) { return /*#__PURE__*/_jsx(TabView, { ...rest, navigationState: state, renderScene: ({ route }) => descriptors[route.key]?.render(), getActiveTintColor: ({ route }) => { return descriptors[route.key]?.options.tabBarActiveTintColor; }, getLabelText: ({ route }) => { const options = descriptors[route.key]?.options; return options?.tabBarLabel !== undefined ? options.tabBarLabel : options?.title !== undefined ? options.title : route.name; }, getBadge: ({ route }) => descriptors[route.key]?.options.tabBarBadge, getHidden: ({ route }) => { const options = descriptors[route.key]?.options; return options?.tabBarItemHidden === true; }, getTestID: ({ route }) => descriptors[route.key]?.options.tabBarButtonTestID, getRole: ({ route }) => descriptors[route.key]?.options.role, tabBar: tabBar ? () => tabBar({ state, descriptors, navigation }) : undefined, getIcon: ({ route, focused }) => { const options = descriptors[route.key]?.options; if (options?.tabBarIcon) { const { tabBarIcon } = options; return tabBarIcon({ focused }); } return null; }, getLazy: ({ route }) => descriptors[route.key]?.options.lazy ?? true, getFreezeOnBlur: ({ route }) => descriptors[route.key]?.options.freezeOnBlur, onTabLongPress: index => { const route = state.routes[index]; if (!route) { return; } navigation.emit({ type: 'tabLongPress', target: route.key }); }, onIndexChange: index => { const route = state.routes[index]; if (!route) { return; } const event = navigation.emit({ type: 'tabPress', target: route.key, canPreventDefault: true }); if (event.defaultPrevented) { return; } else { navigation.dispatch({ ...CommonActions.navigate(route), target: state.key }); } } }); } //# sourceMappingURL=NativeBottomTabView.js.map