1import Constants, { ExecutionEnvironment } from 'expo-constants';
2import { Platform } from 'expo-modules-core';
3import * as Notifications from 'expo-notifications';
4import React from 'react';
5
6import ComponentListScreen from './ComponentListScreen';
7import ExpoAPIIcon from '../components/ExpoAPIIcon';
8
9if (Platform.OS !== 'web') {
10  Notifications.setNotificationHandler({
11    handleNotification: async () => ({
12      shouldShowAlert: true,
13      shouldPlaySound: true,
14      shouldSetBadge: true,
15    }),
16  });
17}
18
19const screens = [
20  'Accelerometer',
21  'ActionSheet',
22  'Alert',
23  'Appearance',
24  'AppleAuthentication',
25  'Audio',
26  'AsyncStorage',
27  'AuthSession',
28  'BackgroundFetch',
29  'BackgroundLocation',
30  'Battery',
31  'Brightness',
32  'Calendars',
33  'Cellular',
34  'Clipboard',
35  'Constants',
36  'Contacts',
37  'Crypto',
38  'Device',
39  'DocumentPicker',
40  'FaceDetector',
41  'FileSystem',
42  'Font',
43  'Errors',
44  'ExpoModules',
45  'Geocoding',
46  'Haptics',
47  'ImageManipulator',
48  'ImagePicker',
49  'IntentLauncher',
50  'KeepAwake',
51  'Linking',
52  'LocalAuthentication',
53  'Localization',
54  'Location',
55  'MailComposer',
56  'MediaLibrary',
57  'Network',
58  'NetInfo',
59  'Notification',
60  'Pedometer',
61  'Permissions',
62  'Print',
63  'Random',
64  'Recording',
65  'SMS',
66  'NavigationBar',
67  'SafeAreaContext',
68  'ScreenOrientation',
69  'SecureStore',
70  'ScreenCapture',
71  'Sensor',
72  'Sharing',
73  'StatusBar',
74  'StoreReview',
75  'SystemUI',
76  'TaskManager',
77  'TextToSpeech',
78  'TrackingTransparency',
79  'ViewShot',
80  'WebBrowser',
81];
82
83if (Constants.executionEnvironment !== ExecutionEnvironment.StoreClient) {
84  screens.push('InAppPurchases');
85}
86
87export const ScreenItems = screens.map((name) => ({
88  name,
89  route: `/apis/${name.toLowerCase()}`,
90  // isAvailable: !!Screens[name],
91  isAvailable: true,
92}));
93
94export default function ExpoApisScreen() {
95  const renderItemRight = React.useCallback(
96    ({ name }: { name: string }) => (
97      <ExpoAPIIcon name={name} style={{ marginRight: 10, marginLeft: 6 }} />
98    ),
99    []
100  );
101
102  return <ComponentListScreen renderItemRight={renderItemRight} apis={ScreenItems} />;
103}
104