1234567891011121314151617181920212223242526272829303132333435363738394041 |
- // @ts-ignore
- import React from 'react';
- import { StyleProp, Text, TextStyle, View } from 'react-native';
-
- // @ts-ignore
- import { navigationStyles } from './styles';
-
- interface ITabBarLabelCounterProps {
- activeUnreadNr: boolean;
- isFocused: boolean;
- label: string;
- nbUnread?: number;
- }
-
- export const TabBarLabelCounter = ({ activeUnreadNr, isFocused, label, nbUnread }: ITabBarLabelCounterProps) => {
- const labelStyles = isFocused
- ? navigationStyles.unreadCounterDescriptionFocused
- : navigationStyles.unreadCounterDescription;
-
- return (
- <View
- style = {
- navigationStyles.unreadCounterContainer as StyleProp<TextStyle> }>
- <Text
- style = { labelStyles }>
- { label && label }
- </Text>
- {
- activeUnreadNr && (
- <View
- style = { navigationStyles.unreadCounterCircle as StyleProp<TextStyle> }>
- <Text
- style = { navigationStyles.unreadCounter as StyleProp<TextStyle> }>
- { nbUnread }
- </Text>
- </View>
- )
- }
- </View>
- );
- };
|