@@ -49,30 +49,28 @@ type AccessibilityEventTypes =
4949 | 'windowStateChange' ;
5050
5151// Mapping of public event names to platform-specific event names.
52- const EventNames : Map <
53- $Keys < AccessibilityEventDefinitions > ,
54- string,
55- > = Platform . OS === 'android'
56- ? new Map ( [
57- [ 'change' , 'touchExplorationDidChange' ] ,
58- [ 'reduceMotionChanged' , 'reduceMotionDidChange' ] ,
59- [ 'highTextContrastChanged' , 'highTextContrastDidChange' ] ,
60- [ 'screenReaderChanged' , 'touchExplorationDidChange' ] ,
61- [ 'accessibilityServiceChanged' , 'accessibilityServiceDidChange' ] ,
62- [ 'invertColorsChanged' , 'invertColorDidChange' ] ,
63- [ 'grayscaleChanged' , 'grayscaleModeDidChange' ] ,
64- ] )
65- : new Map ( [
66- [ 'announcementFinished' , 'announcementFinished' ] ,
67- [ 'boldTextChanged' , 'boldTextChanged' ] ,
68- [ 'change' , 'screenReaderChanged' ] ,
69- [ 'grayscaleChanged' , 'grayscaleChanged' ] ,
70- [ 'invertColorsChanged' , 'invertColorsChanged' ] ,
71- [ 'reduceMotionChanged' , 'reduceMotionChanged' ] ,
72- [ 'reduceTransparencyChanged' , 'reduceTransparencyChanged' ] ,
73- [ 'screenReaderChanged' , 'screenReaderChanged' ] ,
74- [ 'darkerSystemColorsChanged' , 'darkerSystemColorsChanged' ] ,
75- ] ) ;
52+ const EventNames : Map < keyof AccessibilityEventDefinitions , string > =
53+ Platform . OS === 'android'
54+ ? new Map ( [
55+ [ 'change' , 'touchExplorationDidChange' ] ,
56+ [ 'reduceMotionChanged' , 'reduceMotionDidChange' ] ,
57+ [ 'highTextContrastChanged' , 'highTextContrastDidChange' ] ,
58+ [ 'screenReaderChanged' , 'touchExplorationDidChange' ] ,
59+ [ 'accessibilityServiceChanged' , 'accessibilityServiceDidChange' ] ,
60+ [ 'invertColorsChanged' , 'invertColorDidChange' ] ,
61+ [ 'grayscaleChanged' , 'grayscaleModeDidChange' ] ,
62+ ] )
63+ : new Map ( [
64+ [ 'announcementFinished' , 'announcementFinished' ] ,
65+ [ 'boldTextChanged' , 'boldTextChanged' ] ,
66+ [ 'change' , 'screenReaderChanged' ] ,
67+ [ 'grayscaleChanged' , 'grayscaleChanged' ] ,
68+ [ 'invertColorsChanged' , 'invertColorsChanged' ] ,
69+ [ 'reduceMotionChanged' , 'reduceMotionChanged' ] ,
70+ [ 'reduceTransparencyChanged' , 'reduceTransparencyChanged' ] ,
71+ [ 'screenReaderChanged' , 'screenReaderChanged' ] ,
72+ [ 'darkerSystemColorsChanged' , 'darkerSystemColorsChanged' ] ,
73+ ] ) ;
7674
7775/**
7876 * Sometimes it's useful to know whether or not the device has a screen reader
@@ -426,7 +424,7 @@ const AccessibilityInfo = {
426424 *
427425 * See https://reactnative.dev/docs/accessibilityinfo#addeventlistener
428426 */
429- addEventListener < K : $Keys < AccessibilityEventDefinitions > >(
427+ addEventListener < K : keyof AccessibilityEventDefinitions > (
430428 eventName : K ,
431429 // $FlowFixMe[incompatible-type] - Flow bug with unions and generics (T128099423)
432430 handler : ( ...AccessibilityEventDefinitions [ K ] ) => void ,
0 commit comments