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.

CustomMaterialIcon.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // @flow
  2. import * as React from 'react';
  3. import {Icon} from "native-base";
  4. import ThemeManager from '../utils/ThemeManager';
  5. type Props = {
  6. active: boolean,
  7. icon: string,
  8. color: ?string,
  9. fontSize: number,
  10. width: number | string,
  11. }
  12. /**
  13. * Custom component defining a material icon using native base
  14. *
  15. * @prop active {boolean} Whether to set the icon color to active
  16. * @prop icon {string} The icon string to use from MaterialCommunityIcons
  17. * @prop color {string} The icon color. Use default theme color if unspecified
  18. * @prop fontSize {number} The icon size. Use 26 if unspecified
  19. * @prop width {number} The icon width. Use 30 if unspecified
  20. */
  21. export default class CustomMaterialIcon extends React.Component<Props> {
  22. static defaultProps = {
  23. active: false,
  24. color: undefined,
  25. fontSize: 26,
  26. width: 30,
  27. };
  28. render() {
  29. return (
  30. <Icon
  31. active
  32. name={this.props.icon}
  33. type={'MaterialCommunityIcons'}
  34. style={{
  35. color:
  36. this.props.color !== undefined ?
  37. this.props.color :
  38. this.props.active ?
  39. ThemeManager.getCurrentThemeVariables().brandPrimary :
  40. ThemeManager.getCurrentThemeVariables().customMaterialIconColor,
  41. fontSize: this.props.fontSize,
  42. width: this.props.width
  43. }}
  44. />
  45. );
  46. }
  47. }