@react-navigation/bottom-tabs#BottomTabBarProps TypeScript Examples

The following examples show how to use @react-navigation/bottom-tabs#BottomTabBarProps. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TabNavigator.tsx    From nyxo-app with GNU General Public License v3.0 5 votes vote down vote up
TabBar: FC<BottomTabBarProps<BottomTabBarOptions>> = (props) => (
  <BlurViewTabBar blurAmount={100}>
    <BottomTabBar {...props} />
  </BlurViewTabBar>
)
Example #2
Source File: TabNavigator.tsx    From lexicon with MIT License 5 votes vote down vote up
function TabBar({
  state,
  navigation: { navigate },
}: BottomTabBarProps<BottomTabBarOptions>) {
  const insets = useSafeAreaInsets();
  const styles = useStyles();
  const { colors } = useTheme();

  return (
    <View style={styles.tabContainer}>
      {state.routes.map((route: { name: string }, index: number) => {
        const onPress = async () => {
          const token = await getToken();
          if (state.index === 0 && state.index === index) {
            navigate(route.name, { backToTop: true });
          } else {
            if (route.name === 'Profile' && !token) {
              navigate('Login');
              return;
            }
            navigate(route.name, { backToTop: false });
          }
        };

        return (
          <TouchableOpacity
            key={state.routes[index].key}
            onPress={onPress}
            style={styles.tab}
            activeOpacity={state.index === index ? 1 : 0.2}
          >
            <View
              style={[
                { paddingBottom: insets.bottom },
                styles.tabItemContainer,
              ]}
            >
              <Icon
                name={route.name === 'Home' ? 'Home' : 'Person'}
                size="xl"
                color={
                  state.index === index ? colors.activeTab : colors.inactiveTab
                }
              />
              <Text
                color={state.index === index ? 'activeTab' : 'inactiveTab'}
                size="xs"
              >
                {route.name}
              </Text>
            </View>
          </TouchableOpacity>
        );
      })}
    </View>
  );
}
Example #3
Source File: themed-bottom-tab-bar.tsx    From beancount-mobile with MIT License 5 votes vote down vote up
export function ThemedBottomTabBar(
  props: BottomTabBarProps<BottomTabBarOptions>
): JSX.Element {
  const theme = useTheme().colorTheme;
  return (
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    <BottomTabBar
      {...props}
      activeTintColor={theme.activeTintColor}
      inactiveTintColor={theme.inactiveTintColor}
      style={{
        backgroundColor: theme.activeBackgroundColor,
      }}
    />
  );
}