@react-native-oh/react-native-harmony 0.72.38 → 0.72.39-12
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/Libraries/Components/AccessibilityInfo/AccessibilityInfo.harmony.js +202 -206
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfoHarmony.ts +12 -0
- package/Libraries/Components/Image/Image.harmony.js +21 -2
- package/Libraries/Components/Image/NativeImageLoaderHarmony.js +1 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.harmony.js +4 -3
- package/Libraries/Components/TextInput/TextInput.harmony.js +9 -0
- package/Libraries/ReactNative/I18nManager.harmony.js +78 -0
- package/index.js +1 -1
- package/metro.config.js +2 -1
- package/package.json +1 -1
- package/react_native_openharmony.har +0 -0
- package/react_native_openharmony_release.har +0 -0
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.harmony.js +0 -30
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.harmony.js +0 -26
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
// RNOH: patch
|
|
12
12
|
// COPIED FROM: https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js
|
|
13
13
|
|
|
14
|
-
import type { HostComponent } from
|
|
15
|
-
import type { EventSubscription } from
|
|
16
|
-
import type { ElementRef } from
|
|
14
|
+
import type { HostComponent } from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
|
15
|
+
import type { EventSubscription } from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
|
16
|
+
import type { ElementRef } from 'react';
|
|
17
17
|
|
|
18
18
|
// RNOH: patch - imports fixed
|
|
19
|
-
import RCTDeviceEventEmitter from
|
|
20
|
-
import { sendAccessibilityEvent } from
|
|
21
|
-
import Platform from
|
|
22
|
-
import legacySendAccessibilityEvent from
|
|
23
|
-
import NativeAccessibilityInfoAndroid from
|
|
24
|
-
import NativeAccessibilityManagerIOS from
|
|
25
|
-
import
|
|
19
|
+
import RCTDeviceEventEmitter from 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
|
|
20
|
+
import { sendAccessibilityEvent } from 'react-native/Libraries/ReactNative/RendererProxy';
|
|
21
|
+
import Platform from '../../Utilities/Platform';
|
|
22
|
+
import legacySendAccessibilityEvent from 'react-native/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent';
|
|
23
|
+
// import NativeAccessibilityInfoAndroid from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo';
|
|
24
|
+
// import NativeAccessibilityManagerIOS from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager';
|
|
25
|
+
import NativeAccessibilityInfoHarmony from './NativeAccessibilityInfoHarmony';
|
|
26
26
|
|
|
27
27
|
// Events that are only supported on Android.
|
|
28
28
|
type AccessibilityEventDefinitionsAndroid = {
|
|
@@ -46,33 +46,21 @@ type AccessibilityEventDefinitions = {
|
|
|
46
46
|
screenReaderChanged: [boolean],
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
type AccessibilityEventTypes =
|
|
49
|
+
type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
|
|
50
50
|
|
|
51
51
|
// Mapping of public event names to platform-specific event names.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
["accessibilityServiceChanged", "accessibilityServiceChanged"],
|
|
65
|
-
])
|
|
66
|
-
: new Map([
|
|
67
|
-
["announcementFinished", "announcementFinished"],
|
|
68
|
-
["boldTextChanged", "boldTextChanged"],
|
|
69
|
-
["change", "screenReaderChanged"],
|
|
70
|
-
["grayscaleChanged", "grayscaleChanged"],
|
|
71
|
-
["invertColorsChanged", "invertColorsChanged"],
|
|
72
|
-
["reduceMotionChanged", "reduceMotionChanged"],
|
|
73
|
-
["reduceTransparencyChanged", "reduceTransparencyChanged"],
|
|
74
|
-
["screenReaderChanged", "screenReaderChanged"],
|
|
75
|
-
]));
|
|
52
|
+
// RNOH patch
|
|
53
|
+
const EventNames: Map<$Keys<AccessibilityEventDefinitions>, string> = new Map([
|
|
54
|
+
['accessibilityServiceChanged', 'accessibilityServiceChanged'],
|
|
55
|
+
['announcementFinished', 'announcementFinished'],
|
|
56
|
+
['boldTextChanged', 'boldTextChanged'],
|
|
57
|
+
['change', 'screenReaderChanged'],
|
|
58
|
+
['grayscaleChanged', 'grayscaleChanged'],
|
|
59
|
+
['invertColorsChanged', 'invertColorsChanged'],
|
|
60
|
+
['reduceMotionChanged', 'reduceMotionChanged'],
|
|
61
|
+
['reduceTransparencyChanged', 'reduceTransparencyChanged'],
|
|
62
|
+
['screenReaderChanged', 'screenReaderChanged'],
|
|
63
|
+
]);
|
|
76
64
|
|
|
77
65
|
/**
|
|
78
66
|
* Sometimes it's useful to know whether or not the device has a screen reader
|
|
@@ -93,20 +81,22 @@ const AccessibilityInfo = {
|
|
|
93
81
|
* See https://reactnative.dev/docs/accessibilityinfo#isBoldTextEnabled
|
|
94
82
|
*/
|
|
95
83
|
isBoldTextEnabled(): Promise<boolean> {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
84
|
+
// RNOH patch
|
|
85
|
+
return NativeAccessibilityInfoHarmony.isBoldTextEnabled();
|
|
86
|
+
// if (Platform.OS === 'android') {
|
|
87
|
+
// return Promise.resolve(false);
|
|
88
|
+
// } else {
|
|
89
|
+
// return new Promise((resolve, reject) => {
|
|
90
|
+
// if (NativeAccessibilityManagerIOS != null) {
|
|
91
|
+
// NativeAccessibilityManagerIOS.getCurrentBoldTextState(
|
|
92
|
+
// resolve,
|
|
93
|
+
// reject
|
|
94
|
+
// );
|
|
95
|
+
// } else {
|
|
96
|
+
// reject(null);
|
|
97
|
+
// }
|
|
98
|
+
// });
|
|
99
|
+
// }
|
|
110
100
|
},
|
|
111
101
|
|
|
112
102
|
/**
|
|
@@ -118,20 +108,22 @@ const AccessibilityInfo = {
|
|
|
118
108
|
* See https://reactnative.dev/docs/accessibilityinfo#isGrayscaleEnabled
|
|
119
109
|
*/
|
|
120
110
|
isGrayscaleEnabled(): Promise<boolean> {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
111
|
+
// RNOH patch
|
|
112
|
+
return Promise.resolve(false);
|
|
113
|
+
// if (Platform.OS === 'android') {
|
|
114
|
+
// return Promise.resolve(false);
|
|
115
|
+
// } else {
|
|
116
|
+
// return new Promise((resolve, reject) => {
|
|
117
|
+
// if (NativeAccessibilityManagerIOS != null) {
|
|
118
|
+
// NativeAccessibilityManagerIOS.getCurrentGrayscaleState(
|
|
119
|
+
// resolve,
|
|
120
|
+
// reject
|
|
121
|
+
// );
|
|
122
|
+
// } else {
|
|
123
|
+
// reject(null);
|
|
124
|
+
// }
|
|
125
|
+
// });
|
|
126
|
+
// }
|
|
135
127
|
},
|
|
136
128
|
|
|
137
129
|
/**
|
|
@@ -143,20 +135,22 @@ const AccessibilityInfo = {
|
|
|
143
135
|
* See https://reactnative.dev/docs/accessibilityinfo#isInvertColorsEnabled
|
|
144
136
|
*/
|
|
145
137
|
isInvertColorsEnabled(): Promise<boolean> {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
138
|
+
// RNOH patch
|
|
139
|
+
return Promise.resolve(false);
|
|
140
|
+
// if (Platform.OS === 'android') {
|
|
141
|
+
// return Promise.resolve(false);
|
|
142
|
+
// } else {
|
|
143
|
+
// return new Promise((resolve, reject) => {
|
|
144
|
+
// if (NativeAccessibilityManagerIOS != null) {
|
|
145
|
+
// NativeAccessibilityManagerIOS.getCurrentInvertColorsState(
|
|
146
|
+
// resolve,
|
|
147
|
+
// reject
|
|
148
|
+
// );
|
|
149
|
+
// } else {
|
|
150
|
+
// reject(null);
|
|
151
|
+
// }
|
|
152
|
+
// });
|
|
153
|
+
// }
|
|
160
154
|
},
|
|
161
155
|
|
|
162
156
|
/**
|
|
@@ -168,24 +162,26 @@ const AccessibilityInfo = {
|
|
|
168
162
|
* See https://reactnative.dev/docs/accessibilityinfo#isReduceMotionEnabled
|
|
169
163
|
*/
|
|
170
164
|
isReduceMotionEnabled(): Promise<boolean> {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
165
|
+
// RNOH patch
|
|
166
|
+
return Promise.resolve(false);
|
|
167
|
+
// return new Promise((resolve, reject) => {
|
|
168
|
+
// if (Platform.OS === 'android') {
|
|
169
|
+
// if (NativeAccessibilityInfoAndroid != null) {
|
|
170
|
+
// NativeAccessibilityInfoAndroid.isReduceMotionEnabled(resolve);
|
|
171
|
+
// } else {
|
|
172
|
+
// reject(null);
|
|
173
|
+
// }
|
|
174
|
+
// } else {
|
|
175
|
+
// if (NativeAccessibilityManagerIOS != null) {
|
|
176
|
+
// NativeAccessibilityManagerIOS.getCurrentReduceMotionState(
|
|
177
|
+
// resolve,
|
|
178
|
+
// reject
|
|
179
|
+
// );
|
|
180
|
+
// } else {
|
|
181
|
+
// reject(null);
|
|
182
|
+
// }
|
|
183
|
+
// }
|
|
184
|
+
// });
|
|
189
185
|
},
|
|
190
186
|
|
|
191
187
|
/**
|
|
@@ -197,23 +193,25 @@ const AccessibilityInfo = {
|
|
|
197
193
|
* See https://reactnative.dev/docs/accessibilityinfo#prefersCrossFadeTransitions
|
|
198
194
|
*/
|
|
199
195
|
prefersCrossFadeTransitions(): Promise<boolean> {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
196
|
+
// RNOH patch
|
|
197
|
+
return Promise.resolve(false);
|
|
198
|
+
// return new Promise((resolve, reject) => {
|
|
199
|
+
// if (Platform.OS === 'android') {
|
|
200
|
+
// return Promise.resolve(false);
|
|
201
|
+
// } else {
|
|
202
|
+
// if (
|
|
203
|
+
// NativeAccessibilityManagerIOS?.getCurrentPrefersCrossFadeTransitionsState !=
|
|
204
|
+
// null
|
|
205
|
+
// ) {
|
|
206
|
+
// NativeAccessibilityManagerIOS.getCurrentPrefersCrossFadeTransitionsState(
|
|
207
|
+
// resolve,
|
|
208
|
+
// reject
|
|
209
|
+
// );
|
|
210
|
+
// } else {
|
|
211
|
+
// reject(null);
|
|
212
|
+
// }
|
|
213
|
+
// }
|
|
214
|
+
// });
|
|
217
215
|
},
|
|
218
216
|
|
|
219
217
|
/**
|
|
@@ -225,20 +223,22 @@ const AccessibilityInfo = {
|
|
|
225
223
|
* See https://reactnative.dev/docs/accessibilityinfo#isReduceTransparencyEnabled
|
|
226
224
|
*/
|
|
227
225
|
isReduceTransparencyEnabled(): Promise<boolean> {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
226
|
+
// RNOH patch
|
|
227
|
+
return Promise.resolve(false);
|
|
228
|
+
// if (Platform.OS === 'android') {
|
|
229
|
+
// return Promise.resolve(false);
|
|
230
|
+
// } else {
|
|
231
|
+
// return new Promise((resolve, reject) => {
|
|
232
|
+
// if (NativeAccessibilityManagerIOS != null) {
|
|
233
|
+
// NativeAccessibilityManagerIOS.getCurrentReduceTransparencyState(
|
|
234
|
+
// resolve,
|
|
235
|
+
// reject
|
|
236
|
+
// );
|
|
237
|
+
// } else {
|
|
238
|
+
// reject(null);
|
|
239
|
+
// }
|
|
240
|
+
// });
|
|
241
|
+
// }
|
|
242
242
|
},
|
|
243
243
|
|
|
244
244
|
/**
|
|
@@ -250,31 +250,26 @@ const AccessibilityInfo = {
|
|
|
250
250
|
* See https://reactnative.dev/docs/accessibilityinfo#isScreenReaderEnabled
|
|
251
251
|
*/
|
|
252
252
|
isScreenReaderEnabled(): Promise<boolean> {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
} else {
|
|
274
|
-
reject(null);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
});
|
|
253
|
+
// RNOH patch
|
|
254
|
+
return NativeAccessibilityInfoHarmony.isScreenReaderEnabled();
|
|
255
|
+
// return new Promise((resolve, reject) => {
|
|
256
|
+
// if (Platform.OS === 'android') {
|
|
257
|
+
// if (NativeAccessibilityInfoAndroid != null) {
|
|
258
|
+
// NativeAccessibilityInfoAndroid.isTouchExplorationEnabled(resolve);
|
|
259
|
+
// } else {
|
|
260
|
+
// reject(null);
|
|
261
|
+
// }
|
|
262
|
+
// } else {
|
|
263
|
+
// if (NativeAccessibilityManagerIOS != null) {
|
|
264
|
+
// NativeAccessibilityManagerIOS.getCurrentVoiceOverState(
|
|
265
|
+
// resolve,
|
|
266
|
+
// reject
|
|
267
|
+
// );
|
|
268
|
+
// } else {
|
|
269
|
+
// reject(null);
|
|
270
|
+
// }
|
|
271
|
+
// }
|
|
272
|
+
// });
|
|
278
273
|
},
|
|
279
274
|
|
|
280
275
|
/**
|
|
@@ -288,26 +283,22 @@ const AccessibilityInfo = {
|
|
|
288
283
|
* See https://reactnative.dev/docs/accessibilityinfo/#isaccessibilityserviceenabled-android
|
|
289
284
|
*/
|
|
290
285
|
isAccessibilityServiceEnabled(): Promise<boolean> {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
} else {
|
|
308
|
-
reject(null);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
286
|
+
// RNOH patch
|
|
287
|
+
return NativeAccessibilityInfoHarmony.isAccessibilityServiceEnabled();
|
|
288
|
+
// return new Promise((resolve, reject) => {
|
|
289
|
+
// if (Platform.OS === 'android') {
|
|
290
|
+
// if (
|
|
291
|
+
// NativeAccessibilityInfoAndroid != null &&
|
|
292
|
+
// NativeAccessibilityInfoAndroid.isAccessibilityServiceEnabled != null
|
|
293
|
+
// ) {
|
|
294
|
+
// NativeAccessibilityInfoAndroid.isAccessibilityServiceEnabled(resolve);
|
|
295
|
+
// } else {
|
|
296
|
+
// reject(null);
|
|
297
|
+
// }
|
|
298
|
+
// } else {
|
|
299
|
+
// reject(null);
|
|
300
|
+
// }
|
|
301
|
+
// });
|
|
311
302
|
},
|
|
312
303
|
|
|
313
304
|
/**
|
|
@@ -362,7 +353,9 @@ const AccessibilityInfo = {
|
|
|
362
353
|
* See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus
|
|
363
354
|
*/
|
|
364
355
|
setAccessibilityFocus(reactTag: number): void {
|
|
365
|
-
|
|
356
|
+
// RNOH patch
|
|
357
|
+
NativeAccessibilityInfoHarmony.setAccessibilityFocus(reactTag);
|
|
358
|
+
// legacySendAccessibilityEvent(reactTag, 'focus');
|
|
366
359
|
},
|
|
367
360
|
|
|
368
361
|
/**
|
|
@@ -373,7 +366,7 @@ const AccessibilityInfo = {
|
|
|
373
366
|
eventType: AccessibilityEventTypes
|
|
374
367
|
) {
|
|
375
368
|
// iOS only supports 'focus' event types
|
|
376
|
-
if (Platform.OS ===
|
|
369
|
+
if (Platform.OS === 'ios' && eventType === 'click') {
|
|
377
370
|
return;
|
|
378
371
|
}
|
|
379
372
|
// route through React renderer to distinguish between Fabric and non-Fabric handles
|
|
@@ -386,13 +379,13 @@ const AccessibilityInfo = {
|
|
|
386
379
|
* See https://reactnative.dev/docs/accessibilityinfo#announceforaccessibility
|
|
387
380
|
*/
|
|
388
381
|
announceForAccessibility(announcement: string): void {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
} else {
|
|
394
|
-
|
|
395
|
-
}
|
|
382
|
+
// RNOH patch
|
|
383
|
+
NativeAccessibilityInfoHarmony.announceForAccessibility(announcement);
|
|
384
|
+
// if (Platform.OS === 'android') {
|
|
385
|
+
// NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement);
|
|
386
|
+
// } else {
|
|
387
|
+
// NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
|
|
388
|
+
// }
|
|
396
389
|
},
|
|
397
390
|
|
|
398
391
|
/**
|
|
@@ -405,18 +398,19 @@ const AccessibilityInfo = {
|
|
|
405
398
|
announcement: string,
|
|
406
399
|
options: { queue?: boolean }
|
|
407
400
|
): void {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
401
|
+
// RNOH patch
|
|
402
|
+
// if (Platform.OS === 'android') {
|
|
403
|
+
// NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement);
|
|
404
|
+
// } else {
|
|
405
|
+
// if (NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions) {
|
|
406
|
+
// NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions(
|
|
407
|
+
// announcement,
|
|
408
|
+
// options
|
|
409
|
+
// );
|
|
410
|
+
// } else {
|
|
411
|
+
// NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
|
|
412
|
+
// }
|
|
413
|
+
// }
|
|
420
414
|
},
|
|
421
415
|
|
|
422
416
|
/**
|
|
@@ -425,20 +419,22 @@ const AccessibilityInfo = {
|
|
|
425
419
|
* See https://reactnative.dev/docs/accessibilityinfo#getrecommendedtimeoutmillis
|
|
426
420
|
*/
|
|
427
421
|
getRecommendedTimeoutMillis(originalTimeout: number): Promise<number> {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
}
|
|
422
|
+
// RNOH patch
|
|
423
|
+
return Promise.resolve(0);
|
|
424
|
+
// if (Platform.OS === 'android') {
|
|
425
|
+
// return new Promise((resolve, reject) => {
|
|
426
|
+
// if (NativeAccessibilityInfoAndroid?.getRecommendedTimeoutMillis) {
|
|
427
|
+
// NativeAccessibilityInfoAndroid.getRecommendedTimeoutMillis(
|
|
428
|
+
// originalTimeout,
|
|
429
|
+
// resolve
|
|
430
|
+
// );
|
|
431
|
+
// } else {
|
|
432
|
+
// resolve(originalTimeout);
|
|
433
|
+
// }
|
|
434
|
+
// });
|
|
435
|
+
// } else {
|
|
436
|
+
// return Promise.resolve(originalTimeout);
|
|
437
|
+
// }
|
|
442
438
|
},
|
|
443
439
|
};
|
|
444
440
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
2
|
+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
isScreenReaderEnabled: () => Promise<boolean>;
|
|
6
|
+
isAccessibilityServiceEnabled: () => Promise<boolean>;
|
|
7
|
+
isBoldTextEnabled: () => Promise<boolean>;
|
|
8
|
+
announceForAccessibility(announcement: string): Promise<void>;
|
|
9
|
+
setAccessibilityFocus(tag: number): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default TurboModuleRegistry.get<Spec>('AccessibilityInfo');
|
|
@@ -77,14 +77,15 @@ function prefetchWithMetadata(
|
|
|
77
77
|
rootTag ? rootTag : 0,
|
|
78
78
|
);
|
|
79
79
|
} else {
|
|
80
|
-
|
|
80
|
+
const requestId = generateRequestId();
|
|
81
|
+
return NativeImageLoaderHarmony.prefetchImage(url, requestId);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
function prefetch(url: string, callback: ?(requestId: number) => void): any {
|
|
85
86
|
const requestId = generateRequestId();
|
|
86
87
|
callback && callback(requestId);
|
|
87
|
-
return NativeImageLoaderHarmony.prefetchImage(url);
|
|
88
|
+
return NativeImageLoaderHarmony.prefetchImage(url, requestId);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
function abortPrefetch(requestId: number): void {
|
|
@@ -181,6 +182,24 @@ const BaseImage = (props: ImagePropsType, forwardedRef) => {
|
|
|
181
182
|
return (
|
|
182
183
|
<ImageAnalyticsTagContext.Consumer>
|
|
183
184
|
{analyticTag => {
|
|
185
|
+
if (props.accessibilityLabelledBy == undefined &&
|
|
186
|
+
props.accessibilityActions == undefined &&
|
|
187
|
+
props.accessbilityState == undefined &&
|
|
188
|
+
props.accessibilityRole == undefined &&
|
|
189
|
+
props.accessible == undefined &&
|
|
190
|
+
props.accessibilityLabel == undefined) {
|
|
191
|
+
return (
|
|
192
|
+
<ImageViewNativeComponent
|
|
193
|
+
{...restProps}
|
|
194
|
+
ref={forwardedRef}
|
|
195
|
+
style={style}
|
|
196
|
+
resizeMode={resizeMode}
|
|
197
|
+
tintColor={tintColor}
|
|
198
|
+
source={sources}
|
|
199
|
+
internal_analyticTag={analyticTag}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
184
203
|
return (
|
|
185
204
|
<ImageViewNativeComponent
|
|
186
205
|
accessibilityState={_accessibilityState}
|
|
@@ -25,7 +25,7 @@ export interface Spec extends TurboModule {
|
|
|
25
25
|
height: number,
|
|
26
26
|
...
|
|
27
27
|
}>;
|
|
28
|
-
+prefetchImage: (uri: string) => Promise<boolean>;
|
|
28
|
+
+prefetchImage: (uri: string, requestId: number) => Promise<boolean>;
|
|
29
29
|
+prefetchImageWithMetadata?: (
|
|
30
30
|
uri: string,
|
|
31
31
|
queryRootName: string,
|
|
@@ -76,7 +76,8 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
|
|
76
76
|
keyboardFrame: KeyboardMetrics,
|
|
77
77
|
): Promise<number> {
|
|
78
78
|
const frame = this._frame;
|
|
79
|
-
if (!frame || !keyboardFrame
|
|
79
|
+
if (!frame || !keyboardFrame
|
|
80
|
+
|| this.props.enabled === false) { // RNOH patch
|
|
80
81
|
return 0;
|
|
81
82
|
}
|
|
82
83
|
|
|
@@ -206,7 +207,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
|
|
206
207
|
style={StyleSheet.compose(style, heightStyle)}
|
|
207
208
|
onLayout={this._onLayout}
|
|
208
209
|
{...props}>
|
|
209
|
-
{React.Children.map(children, child => React.cloneElement(child, {__keyboardAvoidingViewBottomHeight: bottomHeight}))}
|
|
210
|
+
{React.Children.map(children, child => child && React.cloneElement(child, {__keyboardAvoidingViewBottomHeight: bottomHeight}))}
|
|
210
211
|
</View>
|
|
211
212
|
);
|
|
212
213
|
|
|
@@ -234,7 +235,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
|
|
234
235
|
style={StyleSheet.compose(style, {paddingBottom: bottomHeight})}
|
|
235
236
|
onLayout={this._onLayout}
|
|
236
237
|
{...props}>
|
|
237
|
-
{React.Children.map(children, child => React.cloneElement(child, {__keyboardAvoidingViewBottomHeight: bottomHeight}))}
|
|
238
|
+
{React.Children.map(children, child => child && React.cloneElement(child, {__keyboardAvoidingViewBottomHeight: bottomHeight}))}
|
|
238
239
|
</View>
|
|
239
240
|
);
|
|
240
241
|
|
|
@@ -1312,6 +1312,8 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1312
1312
|
|
|
1313
1313
|
const multiline = props.multiline ?? false;
|
|
1314
1314
|
|
|
1315
|
+
let blurOnSubmit = props.blurOnSubmit; // RNOH patch
|
|
1316
|
+
|
|
1315
1317
|
let submitBehavior: SubmitBehavior;
|
|
1316
1318
|
if (props.submitBehavior != null) {
|
|
1317
1319
|
// `submitBehavior` is set explicitly
|
|
@@ -1330,6 +1332,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1330
1332
|
} else {
|
|
1331
1333
|
// Single line
|
|
1332
1334
|
if (props.blurOnSubmit !== false) {
|
|
1335
|
+
blurOnSubmit = true; // RNOH patch: The default value is true for single-line fields
|
|
1333
1336
|
submitBehavior = 'blurAndSubmit';
|
|
1334
1337
|
} else {
|
|
1335
1338
|
submitBehavior = 'submit';
|
|
@@ -1394,6 +1397,10 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1394
1397
|
let style = flattenStyle(props.style);
|
|
1395
1398
|
|
|
1396
1399
|
if (OS === 'ios') {
|
|
1400
|
+
// RNOH patch
|
|
1401
|
+
const _accessibilityLabelledBy =
|
|
1402
|
+
props?.['aria-labelledby'] ?? props?.accessibilityLabelledBy;
|
|
1403
|
+
|
|
1397
1404
|
const RCTTextInputView =
|
|
1398
1405
|
props.multiline === true
|
|
1399
1406
|
? RCTMultilineTextInputView
|
|
@@ -1412,6 +1419,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1412
1419
|
{...otherProps}
|
|
1413
1420
|
{...eventHandlers}
|
|
1414
1421
|
accessibilityState={_accessibilityState}
|
|
1422
|
+
accessibilityLabelledBy={_accessibilityLabelledBy} // RNOH patch
|
|
1415
1423
|
accessible={accessible}
|
|
1416
1424
|
submitBehavior={submitBehavior}
|
|
1417
1425
|
caretHidden={caretHidden}
|
|
@@ -1431,6 +1439,7 @@ function InternalTextInput(props: Props): React.Node {
|
|
|
1431
1439
|
selection={selection}
|
|
1432
1440
|
style={style}
|
|
1433
1441
|
text={text}
|
|
1442
|
+
blurOnSubmit={blurOnSubmit} // RNOH patch
|
|
1434
1443
|
/>
|
|
1435
1444
|
);
|
|
1436
1445
|
} else if (OS === 'android') {
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import NativeI18nManager from 'react-native/Libraries/ReactNative/NativeI18nManager';
|
|
12
|
+
|
|
13
|
+
const i18nConstants: {|
|
|
14
|
+
doLeftAndRightSwapInRTL: boolean,
|
|
15
|
+
isRTL: boolean,
|
|
16
|
+
localeIdentifier?: ?string,
|
|
17
|
+
|} = getI18nManagerConstants();
|
|
18
|
+
|
|
19
|
+
function getI18nManagerConstants() {
|
|
20
|
+
if (NativeI18nManager) {
|
|
21
|
+
const {isRTL, doLeftAndRightSwapInRTL, localeIdentifier} =
|
|
22
|
+
NativeI18nManager.getConstants();
|
|
23
|
+
return {isRTL, doLeftAndRightSwapInRTL, localeIdentifier};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
isRTL: false,
|
|
28
|
+
doLeftAndRightSwapInRTL: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
getConstants: (): {|
|
|
34
|
+
doLeftAndRightSwapInRTL: boolean,
|
|
35
|
+
isRTL: boolean,
|
|
36
|
+
localeIdentifier: ?string,
|
|
37
|
+
|} => {
|
|
38
|
+
// RNOH patch
|
|
39
|
+
// return i18nConstants;
|
|
40
|
+
return Platform.OS === "harmony" ? getI18nManagerConstants() : i18nConstants;
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
allowRTL: (shouldAllow: boolean) => {
|
|
44
|
+
if (!NativeI18nManager) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
NativeI18nManager.allowRTL(shouldAllow);
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
forceRTL: (shouldForce: boolean) => {
|
|
52
|
+
if (!NativeI18nManager) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
NativeI18nManager.forceRTL(shouldForce);
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
swapLeftAndRightInRTL: (flipStyles: boolean) => {
|
|
60
|
+
if (!NativeI18nManager) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
NativeI18nManager.swapLeftAndRightInRTL(flipStyles);
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
// RNOH patch
|
|
68
|
+
get isRTL() {
|
|
69
|
+
return Platform.OS === "harmony" ? getI18nManagerConstants().isRTL : i18nConstants.isRTL;
|
|
70
|
+
},
|
|
71
|
+
// isRTL: i18nConstants.isRTL,
|
|
72
|
+
|
|
73
|
+
// RNOH patch
|
|
74
|
+
get doLeftAndRightSwapInRTL() {
|
|
75
|
+
return Platform.OS === "harmony" ? getI18nManagerConstants().doLeftAndRightSwapInRTL : i18nConstants.doLeftAndRightSwapInRTL;
|
|
76
|
+
},
|
|
77
|
+
// doLeftAndRightSwapInRTL: i18nConstants.doLeftAndRightSwapInRTL,
|
|
78
|
+
};
|
package/index.js
CHANGED
|
@@ -58,7 +58,7 @@ module.exports = {
|
|
|
58
58
|
return require('react-native/Libraries/Image/ImageBackground');
|
|
59
59
|
},
|
|
60
60
|
get I18nManager() {
|
|
61
|
-
return require('
|
|
61
|
+
return require('./Libraries/ReactNative/I18nManager');
|
|
62
62
|
},
|
|
63
63
|
get LayoutAnimation() {
|
|
64
64
|
return require('react-native/Libraries/LayoutAnimation/LayoutAnimation');
|
package/metro.config.js
CHANGED
|
@@ -87,8 +87,9 @@ function createHarmonyMetroConfig(options) {
|
|
|
87
87
|
pathUtils.dirname(ctx.originModulePath),
|
|
88
88
|
moduleName,
|
|
89
89
|
);
|
|
90
|
+
const slashes = new RegExp('/', 'g');
|
|
90
91
|
const [_, modulePathRelativeToOriginalPackage] = moduleAbsPath.split(
|
|
91
|
-
`${pathUtils.sep}node_modules${pathUtils.sep}${alias}${pathUtils.sep}`,
|
|
92
|
+
`${pathUtils.sep}node_modules${pathUtils.sep}${alias.replace(slashes, pathUtils.sep)}${pathUtils.sep}`,
|
|
92
93
|
);
|
|
93
94
|
const backslashes = new RegExp('\\\\', 'g');
|
|
94
95
|
const pathToHarmonyModule = `${harmonyPackageName}/${modulePathRelativeToOriginalPackage.replace(backslashes, "/")}`;
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
* @flow
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
|
12
|
-
|
|
13
|
-
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
14
|
-
|
|
15
|
-
export interface Spec extends TurboModule {
|
|
16
|
-
+getCurrentBoldTextState: (
|
|
17
|
-
onSuccess: (isBoldTextEnabled: boolean) => void,
|
|
18
|
-
onError: (error: Object) => void,
|
|
19
|
-
) => void;
|
|
20
|
-
+isTouchExplorationEnabled: (
|
|
21
|
-
onSuccess: (isScreenReaderEnabled: boolean) => void,
|
|
22
|
-
) => void;
|
|
23
|
-
+isAccessibilityServiceEnabled?: ?(
|
|
24
|
-
onSuccess: (isAccessibilityServiceEnabled: boolean) => void,
|
|
25
|
-
) => void;
|
|
26
|
-
+setAccessibilityFocus: (reactTag: number) => void;
|
|
27
|
-
+announceForAccessibility: (announcement: string) => void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default (TurboModuleRegistry.get<Spec>('AccessibilityManager'): ?Spec);
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
* @flow strict-local
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import NativeAccessibilityManager from './NativeAccessibilityManager';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* This is a function exposed to the React Renderer that can be used by the
|
|
15
|
-
* pre-Fabric renderer to emit accessibility events to pre-Fabric nodes.
|
|
16
|
-
*/
|
|
17
|
-
function legacySendAccessibilityEvent(
|
|
18
|
-
reactTag: number,
|
|
19
|
-
eventType: string,
|
|
20
|
-
): void {
|
|
21
|
-
if (eventType === 'focus' && NativeAccessibilityManager) {
|
|
22
|
-
NativeAccessibilityManager.setAccessibilityFocus(reactTag);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = legacySendAccessibilityEvent;
|