From 8ea0eb4021feff3664e82e36de8698179d32d45c Mon Sep 17 00:00:00 2001 From: TatianaKapos Date: Wed, 6 Jul 2022 10:31:55 -0700 Subject: [PATCH 1/4] narrator improvements --- src/App.tsx | 13 +++++++++---- src/HomePage.tsx | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 5552f94d..9c039b52 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,7 +11,7 @@ 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 +74,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} @@ -129,11 +133,12 @@ function RenderDrawer(props) { // @ts-ignore function CustomDrawerContent(props) { + return ( props.navigation.closeDrawer()} activeOpacity={0.5783} 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} From 4d966a67d8e25b4d2f559e8e7533c04eae1c7680 Mon Sep 17 00:00:00 2001 From: TatianaKapos Date: Wed, 6 Jul 2022 11:05:26 -0700 Subject: [PATCH 2/4] yarn lint --- src/App.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 9c039b52..c1c81410 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,7 +11,11 @@ import { NavigationContainer, useNavigationState, } from '@react-navigation/native'; -import {createDrawerNavigator, DrawerItem, getIsDrawerOpenFromState} 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'; @@ -81,7 +85,7 @@ function RNGalleryScreenWrapper({navigation}) { navigation.openDrawer()} activeOpacity={0.5783} @@ -133,7 +137,6 @@ function RenderDrawer(props) { // @ts-ignore function CustomDrawerContent(props) { - return ( Date: Thu, 7 Jul 2022 17:27:57 -0700 Subject: [PATCH 3/4] narrator works with permissions --- src/App.tsx | 5 ++- src/examples/PermissionsExamplePage.tsx | 48 ++++++++++++------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index c1c81410..cf55474a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -121,6 +121,7 @@ function RenderDrawerItem(props, i: number) { icon={() => { return {RNGalleryList[i].icon}; }} + accessibilityLabel={RNGalleryList[i].key} /> ); } @@ -141,7 +142,7 @@ function CustomDrawerContent(props) { props.navigation.closeDrawer()} activeOpacity={0.5783} @@ -157,6 +158,7 @@ function CustomDrawerContent(props) { return ; }} style={styles.drawerBottomDivider} + accessibilityLabel={'home'} /> {RenderDrawer(props)} ; }} style={styles.drawerTopDivider} + accessibilityLabel={'settings'} /> ); diff --git a/src/examples/PermissionsExamplePage.tsx b/src/examples/PermissionsExamplePage.tsx index a1806715..92e58922 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,22 @@ 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: Array<[Permission, PermissionStatus]>) => { + var listItems: JSX.Element[] = []; + 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 ( = () => {