Application Android et IOS pour l'amicale des élèves https://play.google.com/store/apps/details?id=fr.amicaleinsat.application
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TabIcon.tsx 877B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from 'react';
  2. import TabHomeIcon from './TabHomeIcon';
  3. import TabSideIcon from './TabSideIcon';
  4. interface Props {
  5. isMiddle: boolean;
  6. focused: boolean;
  7. label: string | undefined;
  8. icon: string;
  9. focusedIcon: string;
  10. onPress: () => void;
  11. }
  12. function TabIcon(props: Props) {
  13. if (props.isMiddle) {
  14. return (
  15. <TabHomeIcon
  16. icon={props.icon}
  17. focusedIcon={props.focusedIcon}
  18. focused={props.focused}
  19. onPress={props.onPress}
  20. />
  21. );
  22. } else {
  23. return (
  24. <TabSideIcon
  25. focused={props.focused}
  26. label={props.label}
  27. icon={props.icon}
  28. focusedIcon={props.focusedIcon}
  29. onPress={props.onPress}
  30. />
  31. );
  32. }
  33. }
  34. function areEqual(prevProps: Props, nextProps: Props) {
  35. return prevProps.focused === nextProps.focused;
  36. }
  37. export default React.memo(TabIcon, areEqual);