Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

TabBarLabelCounter.tsx 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // @ts-ignore
  2. import React from 'react';
  3. import { StyleProp, Text, TextStyle, View } from 'react-native';
  4. // @ts-ignore
  5. import { navigationStyles } from './styles';
  6. interface ITabBarLabelCounterProps {
  7. activeUnreadNr: boolean;
  8. isFocused: boolean;
  9. label: string;
  10. nbUnread?: number;
  11. }
  12. export const TabBarLabelCounter = ({ activeUnreadNr, isFocused, label, nbUnread }: ITabBarLabelCounterProps) => {
  13. const labelStyles = isFocused
  14. ? navigationStyles.unreadCounterDescriptionFocused
  15. : navigationStyles.unreadCounterDescription;
  16. return (
  17. <View
  18. style = {
  19. navigationStyles.unreadCounterContainer as StyleProp<TextStyle> }>
  20. <Text
  21. style = { labelStyles }>
  22. { label && label }
  23. </Text>
  24. {
  25. activeUnreadNr && (
  26. <View
  27. style = { navigationStyles.unreadCounterCircle as StyleProp<TextStyle> }>
  28. <Text
  29. style = { navigationStyles.unreadCounter as StyleProp<TextStyle> }>
  30. { nbUnread }
  31. </Text>
  32. </View>
  33. )
  34. }
  35. </View>
  36. );
  37. };