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.

BaseIndicator.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { View } from 'react-native';
  4. import { Icon } from '../../../base/font-icons';
  5. import styles from './styles';
  6. type Props = {
  7. /**
  8. * True if a highlighted background has to be applied.
  9. */
  10. highlight: boolean,
  11. /**
  12. * The name of the icon to be used as the indicator.
  13. */
  14. icon: string
  15. };
  16. /**
  17. * Implements a base indicator to be reused across all native indicators on
  18. * the filmstrip.
  19. */
  20. export default class BaseIndicator extends Component<Props> {
  21. /**
  22. * Implements React's {@link Component#render()}.
  23. *
  24. * @inheritdoc
  25. */
  26. render() {
  27. const { highlight, icon } = this.props;
  28. const iconElement = (<Icon
  29. name = { icon }
  30. style = { styles.indicator } />
  31. );
  32. if (highlight) {
  33. return (
  34. <View style = { styles.indicatorBackground }>
  35. { iconElement }
  36. </View>
  37. );
  38. }
  39. return iconElement;
  40. }
  41. }