diff --git a/src/App.tsx b/src/App.tsx index 5552f94d..cf55474a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,7 +11,11 @@ import { NavigationContainer, useNavigationState, } from '@react-navigation/native'; -import {createDrawerNavigator, DrawerItem} from '@react-navigation/drawer'; +import { + createDrawerNavigator, + DrawerItem, + getIsDrawerOpenFromState, +} from '@react-navigation/drawer'; import RNGalleryList from './RNGalleryList'; import LightTheme from './themes/LightTheme'; import DarkTheme from './themes/DarkTheme'; @@ -74,11 +78,14 @@ const styles = StyleSheet.create({ function RNGalleryScreenWrapper({navigation}) { const state = useNavigationState((newState) => newState); const Component = RNGalleryList[state.index].component; + const isDrawerOpen = getIsDrawerOpenFromState(navigation.getState()); + return ( navigation.openDrawer()}> navigation.openDrawer()} activeOpacity={0.5783} @@ -113,6 +121,7 @@ function RenderDrawerItem(props, i: number) { icon={() => { return {RNGalleryList[i].icon}; }} + accessibilityLabel={RNGalleryList[i].key} /> ); } @@ -133,7 +142,7 @@ function CustomDrawerContent(props) { props.navigation.closeDrawer()} activeOpacity={0.5783} @@ -149,6 +158,7 @@ function CustomDrawerContent(props) { return ; }} style={styles.drawerBottomDivider} + accessibilityLabel={'home'} /> {RenderDrawer(props)} ; }} style={styles.drawerTopDivider} + accessibilityLabel={'settings'} /> ); diff --git a/src/HomePage.tsx b/src/HomePage.tsx index 04eb00e4..df8f17c4 100644 --- a/src/HomePage.tsx +++ b/src/HomePage.tsx @@ -56,7 +56,7 @@ const HomeContainer = (props: {heading: string; children: React.ReactNode}) => { const {colors} = useTheme(); const styles = createStyles(colors); return ( - + {props.heading} {props.children} diff --git a/src/examples/PermissionsExamplePage.tsx b/src/examples/PermissionsExamplePage.tsx index a1806715..f4f73d41 100644 --- a/src/examples/PermissionsExamplePage.tsx +++ b/src/examples/PermissionsExamplePage.tsx @@ -1,5 +1,5 @@ 'use strict'; -import {Button, FlatList, Text, View} from 'react-native'; +import {Button, Text, View} from 'react-native'; import React, {useEffect, useState} from 'react'; import {Example} from '../components/Example'; import {Page} from '../components/Page'; @@ -88,26 +88,20 @@ export const PermissionsExamplePage: React.FunctionComponent<{}> = () => { setPerms(results); }; - const requestPermission = (perm: Permission) => { - (async () => { - try { - const result = await request(perm); - const newPerms = new Map(perms); - newPerms.set(perm, result); - setPerms(newPerms); - } catch (err) { - console.log(err); - } - })(); + const renderListItems = (data) => { + var listItems = []; + data.forEach((item) => { + listItems.push(); + }); + return listItems; }; - const getListItem = (item /*: [Permission, PermissionStatus]*/) => { - const perm = item[0]; - const status = item[1]; + const ListItem = (props: {item}) => { + const perm = props.item[0]; + const [status, setStatus] = useState(props.item[1]); return ( = () => {