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.

functions.js 691B

12345678910111213141516171819202122232425262728293031
  1. // @flow
  2. import { Alert, Linking, NativeModules } from 'react-native';
  3. import { Platform } from '../../base/react';
  4. /**
  5. * Opens the settings panel for the current platform.
  6. *
  7. * @private
  8. * @returns {void}
  9. */
  10. export function openSettings() {
  11. switch (Platform.OS) {
  12. case 'android':
  13. NativeModules.AndroidSettings.open().catch(() => {
  14. Alert.alert(
  15. 'Error opening settings',
  16. 'Please open settings and grant the required permissions',
  17. [
  18. { text: 'OK' }
  19. ]
  20. );
  21. });
  22. break;
  23. case 'ios':
  24. Linking.openURL('app-settings:');
  25. break;
  26. }
  27. }