Application Android et IOS pour l'amicale des élèves
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.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 {CustomTheme} from "../../../managers/ThemeManager";
  6. import type {ServiceItem} from "../../../managers/ServicesManager";
  7. type Props = {
  8. item: ServiceItem,
  9. isActive: boolean,
  10. height: number,
  11. onPress: () => void,
  12. theme: CustomTheme,
  13. }
  14. class DashboardEditItem extends React.Component<Props> {
  15. shouldComponentUpdate(nextProps: Props) {
  16. return (nextProps.isActive !== this.props.isActive);
  17. }
  18. render() {
  19. return (
  20. <List.Item
  21. title={this.props.item.title}
  22. description={this.props.item.subtitle}
  23. onPress={this.props.isActive ? null : this.props.onPress}
  24. left={props =>
  25. <Image
  26. {...props}
  27. source={{uri: this.props.item.image}}
  28. style={{
  29. width: 40,
  30. height: 40
  31. }}
  32. />}
  33. right={props => this.props.isActive
  34. ? <List.Icon
  35. {...props}
  36. icon={"check"}
  37. color={this.props.theme.colors.success}
  38. /> : null}
  39. style={{
  40. height: this.props.height,
  41. justifyContent: 'center',
  42. paddingLeft: 30,
  43. backgroundColor: this.props.isActive ? this.props.theme.colors.proxiwashFinishedColor : "transparent"
  44. }}
  45. />
  46. );
  47. }
  48. }
  49. export default withTheme(DashboardEditItem);