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.

DashboardEditItem.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // @flow
  2. import * as React from 'react';
  3. import {Image} from 'react-native';
  4. import {List, withTheme} from 'react-native-paper';
  5. import type {CustomThemeType} from '../../../managers/ThemeManager';
  6. import type {ServiceItemType} from '../../../managers/ServicesManager';
  7. type PropsType = {
  8. item: ServiceItemType,
  9. isActive: boolean,
  10. height: number,
  11. onPress: () => void,
  12. theme: CustomThemeType,
  13. };
  14. class DashboardEditItem extends React.Component<PropsType> {
  15. shouldComponentUpdate(nextProps: PropsType): boolean {
  16. const {isActive} = this.props;
  17. return nextProps.isActive !== isActive;
  18. }
  19. render(): React.Node {
  20. const {props} = this;
  21. return (
  22. <List.Item
  23. title={props.item.title}
  24. description={props.item.subtitle}
  25. onPress={props.isActive ? null : props.onPress}
  26. left={(): React.Node => (
  27. <Image
  28. source={{uri: props.item.image}}
  29. style={{
  30. width: 40,
  31. height: 40,
  32. }}
  33. />
  34. )}
  35. right={({size}: {size: number}): React.Node =>
  36. props.isActive ? (
  37. <List.Icon
  38. size={size}
  39. icon="check"
  40. color={props.theme.colors.success}
  41. />
  42. ) : null
  43. }
  44. style={{
  45. height: props.height,
  46. justifyContent: 'center',
  47. paddingLeft: 30,
  48. backgroundColor: props.isActive
  49. ? props.theme.colors.proxiwashFinishedColor
  50. : 'transparent',
  51. }}
  52. />
  53. );
  54. }
  55. }
  56. export default withTheme(DashboardEditItem);