Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

WelcomePageLists.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { Platform } from 'react-native';
  4. import { translate } from '../../base/i18n';
  5. import { PagedList } from '../../base/react';
  6. import { MeetingList } from '../../calendar-sync';
  7. import { RecentList } from '../../recent-list';
  8. type Props = {
  9. /**
  10. * Renders the lists disabled.
  11. */
  12. disabled: boolean,
  13. /**
  14. * The i18n translate function.
  15. */
  16. t: Function
  17. };
  18. /**
  19. * Icon to be used for the calendar page on iOS.
  20. */
  21. const IOS_CALENDAR_ICON = require('../../../../images/calendar.png');
  22. /**
  23. * Icon to be used for the recent list page on iOS.
  24. */
  25. const IOS_RECENT_LIST_ICON = require('../../../../images/history.png');
  26. /**
  27. * Implements the lists displayed on the mobile welcome screen.
  28. */
  29. class WelcomePageLists extends Component<Props> {
  30. /**
  31. * The pages to be rendered.
  32. * Note: The component field may be undefined if a feature (such as
  33. * Calendar) is disabled, and that means that the page must not be rendered.
  34. */
  35. pages: Array<{
  36. component: Object,
  37. icon: string | number,
  38. title: string
  39. }>
  40. /**
  41. * Component contructor.
  42. *
  43. * @inheritdoc
  44. */
  45. constructor(props) {
  46. super(props);
  47. const { t } = props;
  48. const isAndroid = Platform.OS === 'android';
  49. this.pages = [ {
  50. component: RecentList,
  51. icon: isAndroid ? 'restore' : IOS_RECENT_LIST_ICON,
  52. title: t('welcomepage.recentList')
  53. }, {
  54. component: MeetingList,
  55. icon: isAndroid ? 'event_note' : IOS_CALENDAR_ICON,
  56. title: t('welcomepage.calendar')
  57. } ];
  58. }
  59. /**
  60. * Implements React Component's render.
  61. *
  62. * @inheritdoc
  63. */
  64. render() {
  65. const { disabled } = this.props;
  66. return (
  67. <PagedList
  68. defaultPage = { 0 }
  69. disabled = { disabled }
  70. pages = { this.pages } />
  71. );
  72. }
  73. }
  74. export default translate(WelcomePageLists);