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.

DashboardEditPreviewItem.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // @flow
  2. import * as React from 'react';
  3. import {TouchableRipple, withTheme} from 'react-native-paper';
  4. import {Dimensions, Image, View} from 'react-native';
  5. import type {CustomTheme} from '../../../managers/ThemeManager';
  6. type PropsType = {
  7. image: string,
  8. isActive: boolean,
  9. onPress: () => void,
  10. theme: CustomTheme,
  11. };
  12. /**
  13. * Component used to render a small dashboard item
  14. */
  15. class DashboardEditPreviewItem extends React.Component<PropsType> {
  16. itemSize: number;
  17. constructor(props: PropsType) {
  18. super(props);
  19. this.itemSize = Dimensions.get('window').width / 8;
  20. }
  21. render(): React.Node {
  22. const {props} = this;
  23. return (
  24. <TouchableRipple
  25. onPress={props.onPress}
  26. borderless
  27. style={{
  28. marginLeft: 5,
  29. marginRight: 5,
  30. backgroundColor: props.isActive
  31. ? props.theme.colors.textDisabled
  32. : 'transparent',
  33. borderRadius: 5,
  34. }}>
  35. <View
  36. style={{
  37. width: this.itemSize,
  38. height: this.itemSize,
  39. }}>
  40. <Image
  41. source={{uri: props.image}}
  42. style={{
  43. width: '100%',
  44. height: '100%',
  45. }}
  46. />
  47. </View>
  48. </TouchableRipple>
  49. );
  50. }
  51. }
  52. export default withTheme(DashboardEditPreviewItem);