diff --git a/native/apps/apps-directory.react.js b/native/apps/apps-directory.react.js index eb734749b..8f862d305 100644 --- a/native/apps/apps-directory.react.js +++ b/native/apps/apps-directory.react.js @@ -1,78 +1,88 @@ // @flow import * as React from 'react'; import { Text, FlatList, View } from 'react-native'; +import type { SupportedApps } from 'lib/types/enabled-apps.js'; + import AppListing from './app-listing.react.js'; import type { NavigationRoute } from '../navigation/route-names.js'; import type { TabNavigationProp } from '../navigation/tab-navigator.react.js'; import { useSelector } from '../redux/redux-utils.js'; import { useStyles } from '../themes/colors.js'; -const APP_DIRECTORY_DATA = [ +type Item = { + +id: SupportedApps | 'chat', + +alwaysEnabled: boolean, + +appName: string, + +appIcon: 'message-square' | 'calendar', + +appCopy: string, +}; + +const APP_DIRECTORY_DATA: $ReadOnlyArray = [ { id: 'chat', alwaysEnabled: true, appName: 'Chat', appIcon: 'message-square', appCopy: 'Keep in touch with your community', }, { id: 'calendar', alwaysEnabled: false, appName: 'Calendar', appIcon: 'calendar', appCopy: 'Shared calendar for your community', }, ]; type Props = { +navigation: TabNavigationProp<'Apps'>, +route: NavigationRoute<'Apps'>, }; // eslint-disable-next-line no-unused-vars function AppsDirectory(props: Props): React.Node { const styles = useStyles(unboundStyles); const enabledApps = useSelector(state => state.enabledApps); const renderAppCell = React.useCallback( - ({ item }) => ( + ({ item }: { +item: Item, ... }) => ( ), [enabledApps], ); - const getItemID = React.useCallback(item => item.id, []); + const getItemID = React.useCallback((item: Item) => item.id, []); return ( Choose Apps ); } const unboundStyles = { view: { flex: 1, backgroundColor: 'panelBackground', padding: 18, }, title: { color: 'modalForegroundLabel', fontSize: 28, paddingVertical: 12, }, }; export default AppsDirectory;