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.

constants.js 959B

12345678910111213141516171819202122232425262728293031323334353637
  1. // @flow
  2. import { NativeModules } from 'react-native';
  3. /**
  4. * The indicator which determines whether the calendar feature is enabled by the
  5. * app.
  6. *
  7. * @type {boolean}
  8. */
  9. export const CALENDAR_ENABLED = _isCalendarEnabled();
  10. /**
  11. * The default state of the calendar.
  12. *
  13. * NOTE: This is defined here, to be reusable by functions.js as well (see file
  14. * for details).
  15. */
  16. export const DEFAULT_STATE = {
  17. authorization: undefined,
  18. events: []
  19. };
  20. /**
  21. * Determines whether the calendar feature is enabled by the app. For
  22. * example, Apple through its App Store requires
  23. * {@code NSCalendarsUsageDescription} in the app's Info.plist or App Store
  24. * rejects the app.
  25. *
  26. * @returns {boolean} If the app has enabled the calendar feature, {@code true};
  27. * otherwise, {@code false}.
  28. */
  29. function _isCalendarEnabled() {
  30. const { calendarEnabled } = NativeModules.AppInfo;
  31. return typeof calendarEnabled === 'undefined' ? true : calendarEnabled;
  32. }