選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

TabBarLabelCounter.tsx 1.2KB

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