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.

1234567891011121314151617181920212223242526
  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. * Determines whether the calendar feature is enabled by the app. For
  12. * example, Apple through its App Store requires
  13. * {@code NSCalendarsUsageDescription} in the app's Info.plist or App Store
  14. * rejects the app.
  15. *
  16. * @returns {boolean} If the app has enabled the calendar feature, {@code true};
  17. * otherwise, {@code false}.
  18. */
  19. function _isCalendarEnabled() {
  20. const { calendarEnabled } = NativeModules.AppInfo;
  21. return typeof calendarEnabled === 'undefined' ? true : calendarEnabled;
  22. }