@office-iss/react-native-win32 0.71.17 → 0.71.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.flowconfig CHANGED
@@ -10,6 +10,7 @@
10
10
  ; initRNLibraries build step
11
11
  <PROJECT_ROOT>/index.js
12
12
  <PROJECT_ROOT>/Libraries/Alert/Alert.js
13
+ <PROJECT_ROOT>/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js
13
14
  <PROJECT_ROOT>/Libraries/Components/Pressable/Pressable.js
14
15
  <PROJECT_ROOT>/Libraries/Components/SafeAreaView/SafeAreaView.js
15
16
  <PROJECT_ROOT>/Libraries/Components/TextInput/TextInput.js
package/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@office-iss/react-native-win32",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 03 Oct 2023 02:36:38 GMT",
5
+ "date": "Mon, 23 Oct 2023 15:13:46 GMT",
6
+ "tag": "@office-iss/react-native-win32_v0.71.18",
7
+ "version": "0.71.18",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "krsiler@microsoft.com",
12
+ "package": "@office-iss/react-native-win32",
13
+ "commit": "7f2e4a1c25ff31e216473db135cbd445406d1f5c",
14
+ "comment": "add support for announceForAccessibilityWithOptions"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 03 Oct 2023 02:37:00 GMT",
6
21
  "tag": "@office-iss/react-native-win32_v0.71.17",
7
22
  "version": "0.71.17",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,17 +1,25 @@
1
1
  # Change Log - @office-iss/react-native-win32
2
2
 
3
- This log was last generated on Tue, 03 Oct 2023 02:36:38 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 23 Oct 2023 15:13:46 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.71.17
7
+ ## 0.71.18
8
8
 
9
- Tue, 03 Oct 2023 02:36:38 GMT
9
+ Mon, 23 Oct 2023 15:13:46 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - Have RCTNetworking.win32 fork RCTNetworking.ios (#12199) (julio.rocha@microsoft.com)
13
+ - add support for announceForAccessibilityWithOptions (krsiler@microsoft.com)
14
14
 
15
+ ## 0.71.17
16
+
17
+ Tue, 03 Oct 2023 02:37:00 GMT
18
+
19
+ ### Patches
20
+
21
+ - Have RCTNetworking.win32 fork RCTNetworking.ios (#12199) (julio.rocha@microsoft.com)
22
+
15
23
  ## 0.71.16
16
24
 
17
25
  Mon, 11 Sep 2023 15:13:29 GMT
@@ -37,7 +37,7 @@ type AccessibilityAnnouncementFinishedEventHandler = (
37
37
  event: AccessibilityAnnouncementFinishedEvent,
38
38
  ) => void;
39
39
 
40
- type AccessibilityEventTypes = 'click' | 'focus';
40
+ type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
41
41
 
42
42
  /**
43
43
  * @see https://reactnative.dev/docs/accessibilityinfo
@@ -134,10 +134,14 @@ export interface AccessibilityInfoStatic {
134
134
  * - `announcement`: The string announced by the screen reader.
135
135
  * - `options`: An object that configures the reading options.
136
136
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
137
+ * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
137
138
  */
138
139
  announceForAccessibilityWithOptions(
139
140
  announcement: string,
140
- options: {queue?: boolean},
141
+ options: {
142
+ queue?: boolean | undefined;
143
+ nativeID?: string | undefined; // win32
144
+ },
141
145
  ): void;
142
146
 
143
147
  /**
@@ -18,6 +18,7 @@ import {sendAccessibilityEvent} from '../../ReactNative/RendererProxy';
18
18
  import Platform from '../../Utilities/Platform';
19
19
  import legacySendAccessibilityEvent from './legacySendAccessibilityEvent';
20
20
  import NativeAccessibilityInfo from './NativeAccessibilityInfo';
21
+ import NativeAccessibilityInfoWin32 from './NativeAccessibilityInfoWin32';
21
22
  import NativeAccessibilityManagerIOS from './NativeAccessibilityManager';
22
23
 
23
24
  // Events that are only supported on Android.
@@ -167,12 +168,18 @@ const AccessibilityInfo: AccessibilityInfoType = {
167
168
  */
168
169
  isReduceMotionEnabled(): Promise<boolean> {
169
170
  return new Promise((resolve, reject) => {
170
- if (Platform.OS === 'android' || Platform.OS === 'win32') {
171
+ if (Platform.OS === 'android') {
171
172
  if (NativeAccessibilityInfo != null) {
172
173
  NativeAccessibilityInfo.isReduceMotionEnabled(resolve);
173
174
  } else {
174
175
  reject(null);
175
176
  }
177
+ } else if (Platform.OS === 'win32') {
178
+ if (NativeAccessibilityInfoWin32 != null) {
179
+ NativeAccessibilityInfoWin32.isReduceMotionEnabled(resolve);
180
+ } else {
181
+ reject(null);
182
+ }
176
183
  } else {
177
184
  if (NativeAccessibilityManagerIOS != null) {
178
185
  NativeAccessibilityManagerIOS.getCurrentReduceMotionState(
@@ -249,12 +256,18 @@ const AccessibilityInfo: AccessibilityInfoType = {
249
256
  */
250
257
  isScreenReaderEnabled(): Promise<boolean> {
251
258
  return new Promise((resolve, reject) => {
252
- if (Platform.OS === 'android' || Platform.OS === 'win32') {
259
+ if (Platform.OS === 'android') {
253
260
  if (NativeAccessibilityInfo != null) {
254
261
  NativeAccessibilityInfo.isTouchExplorationEnabled(resolve);
255
262
  } else {
256
263
  reject(null);
257
264
  }
265
+ } else if (Platform.OS === 'win32') {
266
+ if (NativeAccessibilityInfoWin32 != null) {
267
+ NativeAccessibilityInfoWin32.isTouchExplorationEnabled(resolve);
268
+ } else {
269
+ reject(null);
270
+ }
258
271
  } else {
259
272
  if (NativeAccessibilityManagerIOS != null) {
260
273
  NativeAccessibilityManagerIOS.getCurrentVoiceOverState(
@@ -371,8 +384,10 @@ const AccessibilityInfo: AccessibilityInfoType = {
371
384
  * See https://reactnative.dev/docs/accessibilityinfo#announceforaccessibility
372
385
  */
373
386
  announceForAccessibility(announcement: string): void {
374
- if (Platform.OS === 'android' || Platform.OS === 'win32') {
387
+ if (Platform.OS === 'android') {
375
388
  NativeAccessibilityInfo?.announceForAccessibility(announcement);
389
+ } else if (Platform.OS === 'win32') {
390
+ NativeAccessibilityInfoWin32?.announceForAccessibility(announcement);
376
391
  } else {
377
392
  NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
378
393
  }
@@ -383,18 +398,34 @@ const AccessibilityInfo: AccessibilityInfoType = {
383
398
  * - `announcement`: The string announced by the screen reader.
384
399
  * - `options`: An object that configures the reading options.
385
400
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
401
+ * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
386
402
  */
403
+ // $FlowIgnore[prop-missing]
387
404
  announceForAccessibilityWithOptions(
388
405
  announcement: string,
389
- options: {queue?: boolean},
406
+ options: {
407
+ queue?: boolean,
408
+ nativeID?: string, // win32
409
+ },
390
410
  ): void {
391
- if (Platform.OS === 'android' || Platform.OS === 'win32') {
411
+ if (Platform.OS === 'android') {
392
412
  NativeAccessibilityInfo?.announceForAccessibility(announcement);
413
+ } else if (Platform.OS === 'win32') {
414
+ if (NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions) {
415
+ NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions(
416
+ announcement,
417
+ options,
418
+ );
419
+ } else {
420
+ NativeAccessibilityInfoWin32?.announceForAccessibility(announcement);
421
+ }
393
422
  } else {
394
423
  if (NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions) {
424
+ const {nativeID: _, ...iosOptions} = options;
425
+ // $FlowFixMe[prop-missing]
395
426
  NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions(
396
427
  announcement,
397
- options,
428
+ iosOptions,
398
429
  );
399
430
  } else {
400
431
  NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
@@ -408,7 +439,7 @@ const AccessibilityInfo: AccessibilityInfoType = {
408
439
  * See https://reactnative.dev/docs/accessibilityinfo#getrecommendedtimeoutmillis
409
440
  */
410
441
  getRecommendedTimeoutMillis(originalTimeout: number): Promise<number> {
411
- if (Platform.OS === 'android' || Platform.OS === 'win32') {
442
+ if (Platform.OS === 'android') {
412
443
  return new Promise((resolve, reject) => {
413
444
  if (NativeAccessibilityInfo?.getRecommendedTimeoutMillis) {
414
445
  NativeAccessibilityInfo.getRecommendedTimeoutMillis(
@@ -419,6 +450,17 @@ const AccessibilityInfo: AccessibilityInfoType = {
419
450
  resolve(originalTimeout);
420
451
  }
421
452
  });
453
+ } else if (Platform.OS === 'win32') {
454
+ return new Promise((resolve, reject) => {
455
+ if (NativeAccessibilityInfoWin32?.getRecommendedTimeoutMillis) {
456
+ NativeAccessibilityInfoWin32.getRecommendedTimeoutMillis(
457
+ originalTimeout,
458
+ resolve,
459
+ );
460
+ } else {
461
+ resolve(originalTimeout);
462
+ }
463
+ });
422
464
  } else {
423
465
  return Promise.resolve(originalTimeout);
424
466
  }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ * @flow
7
+ */
8
+
9
+ import type {TurboModule} from '../../TurboModule/RCTExport';
10
+
11
+ import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';
12
+
13
+ export interface Spec extends TurboModule {
14
+ +isReduceMotionEnabled: (
15
+ onSuccess: (isReduceMotionEnabled: boolean) => void,
16
+ ) => void;
17
+ +isTouchExplorationEnabled: (
18
+ onSuccess: (isScreenReaderEnabled: boolean) => void,
19
+ ) => void;
20
+ +isAccessibilityServiceEnabled?: ?(
21
+ onSuccess: (isAccessibilityServiceEnabled: boolean) => void,
22
+ ) => void;
23
+ +setAccessibilityFocus: (reactTag: number) => void;
24
+ +announceForAccessibility: (announcement: string) => void;
25
+ // [Win32
26
+ +announceForAccessibilityWithOptions?: (
27
+ announcement: string,
28
+ options: {queue?: boolean, nativeID?: string},
29
+ ) => void;
30
+ // Win32]
31
+ +getRecommendedTimeoutMillis?: (
32
+ mSec: number,
33
+ onSuccess: (recommendedTimeoutMillis: number) => void,
34
+ ) => void;
35
+ }
36
+
37
+ export default (TurboModuleRegistry.get<Spec>('AccessibilityInfo'): ?Spec);
package/overrides.json CHANGED
@@ -32,11 +32,16 @@
32
32
  "baseHash": "897569d77df852480332b7ce7ec1b594cf40aa28"
33
33
  },
34
34
  {
35
- "type": "patch",
35
+ "type": "derived",
36
+ "file": "src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts",
37
+ "baseFile": "Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts",
38
+ "baseHash": "7b4cf9114df53038aeb1508f77d868b45e09049b"
39
+ },
40
+ {
41
+ "type": "derived",
36
42
  "file": "src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js",
37
43
  "baseFile": "Libraries/Components/AccessibilityInfo/AccessibilityInfo.js",
38
- "baseHash": "8ed7c87f3165558abe517218143dc6f73d91cc46",
39
- "issue": 4578
44
+ "baseHash": "8ed7c87f3165558abe517218143dc6f73d91cc46"
40
45
  },
41
46
  {
42
47
  "type": "copy",
@@ -45,6 +50,12 @@
45
50
  "baseHash": "d37b2f72125246ababf3260e99ef790ce76fe3bb",
46
51
  "issue": 4578
47
52
  },
53
+ {
54
+ "type": "derived",
55
+ "file": "src/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfoWin32.js",
56
+ "baseFile": "Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js",
57
+ "baseHash": "9427a7feebfbe3de606b2d100439cabf2faa8661"
58
+ },
48
59
  {
49
60
  "type": "platform",
50
61
  "file": "src/Libraries/Components/Button/ButtonWin32.Props.ts"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.71.17",
3
+ "version": "0.71.18",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "license": "MIT",
6
6
  "main": "./index.win32.js",
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+ import type * as React from 'react';
11
+ import {HostComponent} from '../../../types/public/ReactNativeTypes';
12
+ import {EmitterSubscription} from '../../vendor/emitter/EventEmitter';
13
+
14
+ type AccessibilityChangeEventName =
15
+ | 'change' // deprecated, maps to screenReaderChanged
16
+ | 'boldTextChanged' // iOS-only Event
17
+ | 'grayscaleChanged' // iOS-only Event
18
+ | 'invertColorsChanged' // iOS-only Event
19
+ | 'reduceMotionChanged'
20
+ | 'screenReaderChanged'
21
+ | 'reduceTransparencyChanged'; // iOS-only Event
22
+
23
+ type AccessibilityChangeEvent = boolean;
24
+
25
+ type AccessibilityChangeEventHandler = (
26
+ event: AccessibilityChangeEvent,
27
+ ) => void;
28
+
29
+ type AccessibilityAnnouncementEventName = 'announcementFinished'; // iOS-only Event
30
+
31
+ type AccessibilityAnnouncementFinishedEvent = {
32
+ announcement: string;
33
+ success: boolean;
34
+ };
35
+
36
+ type AccessibilityAnnouncementFinishedEventHandler = (
37
+ event: AccessibilityAnnouncementFinishedEvent,
38
+ ) => void;
39
+
40
+ type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
41
+
42
+ /**
43
+ * @see https://reactnative.dev/docs/accessibilityinfo
44
+ */
45
+ export interface AccessibilityInfoStatic {
46
+ /**
47
+ * Query whether bold text is currently enabled.
48
+ *
49
+ * @platform ios
50
+ */
51
+ isBoldTextEnabled: () => Promise<boolean>;
52
+
53
+ /**
54
+ * Query whether grayscale is currently enabled.
55
+ *
56
+ * @platform ios
57
+ */
58
+ isGrayscaleEnabled: () => Promise<boolean>;
59
+
60
+ /**
61
+ * Query whether invert colors is currently enabled.
62
+ *
63
+ * @platform ios
64
+ */
65
+ isInvertColorsEnabled: () => Promise<boolean>;
66
+
67
+ /**
68
+ * Query whether reduce motion is currently enabled.
69
+ */
70
+ isReduceMotionEnabled: () => Promise<boolean>;
71
+
72
+ /**
73
+ * Query whether reduce motion and prefer cross-fade transitions settings are currently enabled.
74
+ *
75
+ * Returns a promise which resolves to a boolean.
76
+ * The result is `true` when prefer cross-fade transitions is enabled and `false` otherwise.
77
+ */
78
+ prefersCrossFadeTransitions(): Promise<boolean>;
79
+
80
+ /**
81
+ * Query whether reduce transparency is currently enabled.
82
+ *
83
+ * @platform ios
84
+ */
85
+ isReduceTransparencyEnabled: () => Promise<boolean>;
86
+
87
+ /**
88
+ * Query whether a screen reader is currently enabled.
89
+ */
90
+ isScreenReaderEnabled: () => Promise<boolean>;
91
+
92
+ /**
93
+ * Query whether Accessibility Service is currently enabled.
94
+ *
95
+ * Returns a promise which resolves to a boolean.
96
+ * The result is `true` when any service is enabled and `false` otherwise.
97
+ *
98
+ * @platform android
99
+ */
100
+ isAccessibilityServiceEnabled(): Promise<boolean>;
101
+
102
+ /**
103
+ * Add an event handler. Supported events:
104
+ * - announcementFinished: iOS-only event. Fires when the screen reader has finished making an announcement.
105
+ * The argument to the event handler is a dictionary with these keys:
106
+ * - announcement: The string announced by the screen reader.
107
+ * - success: A boolean indicating whether the announcement was successfully made.
108
+ * - AccessibilityEventName constants other than announcementFinished: Fires on accessibility feature change.
109
+ * The argument to the event handler is a boolean.
110
+ * The boolean is true when the related event's feature is enabled and false otherwise.
111
+ *
112
+ */
113
+ addEventListener(
114
+ eventName: AccessibilityChangeEventName,
115
+ handler: AccessibilityChangeEventHandler,
116
+ ): EmitterSubscription;
117
+ addEventListener(
118
+ eventName: AccessibilityAnnouncementEventName,
119
+ handler: AccessibilityAnnouncementFinishedEventHandler,
120
+ ): EmitterSubscription;
121
+
122
+ /**
123
+ * Set accessibility focus to a react component.
124
+ */
125
+ setAccessibilityFocus: (reactTag: number) => void;
126
+
127
+ /**
128
+ * Post a string to be announced by the screen reader.
129
+ */
130
+ announceForAccessibility: (announcement: string) => void;
131
+
132
+ /**
133
+ * Post a string to be announced by the screen reader.
134
+ * - `announcement`: The string announced by the screen reader.
135
+ * - `options`: An object that configures the reading options.
136
+ * - `queue`: The announcement will be queued behind existing announcements. iOS only.
137
+ * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
138
+ */
139
+ announceForAccessibilityWithOptions(
140
+ announcement: string,
141
+ options: {
142
+ queue?: boolean | undefined;
143
+ nativeID?: string | undefined; // win32
144
+ },
145
+ ): void;
146
+
147
+ /**
148
+ * Gets the timeout in millisecond that the user needs.
149
+ * This value is set in "Time to take action (Accessibility timeout)" of "Accessibility" settings.
150
+ *
151
+ * @platform android
152
+ */
153
+ getRecommendedTimeoutMillis: (originalTimeout: number) => Promise<number>;
154
+ sendAccessibilityEvent: (
155
+ handle: React.ElementRef<HostComponent<unknown>>,
156
+ eventType: AccessibilityEventTypes,
157
+ ) => void;
158
+ }
159
+
160
+ export const AccessibilityInfo: AccessibilityInfoStatic;
161
+ export type AccessibilityInfo = AccessibilityInfoStatic;