@react-native-oh/react-native-harmony 0.72.38-3 → 0.72.39-11

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.
@@ -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 "react-native/Libraries/Renderer/shims/ReactNativeTypes";
15
- import type { EventSubscription } from "react-native/Libraries/vendor/emitter/EventEmitter";
16
- import type { ElementRef } from "react";
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 "react-native/Libraries/EventEmitter/RCTDeviceEventEmitter";
20
- import { sendAccessibilityEvent } from "react-native/Libraries/ReactNative/RendererProxy";
21
- import Platform from "../../Utilities/Platform";
22
- import legacySendAccessibilityEvent from "./legacySendAccessibilityEvent";
23
- import NativeAccessibilityInfoAndroid from "react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo";
24
- import NativeAccessibilityManagerIOS from "react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager";
25
- import NativeAccessibilityManagerHarmony from "./NativeAccessibilityManager";
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 = "click" | "focus" | "viewHoverEnter";
49
+ type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
50
50
 
51
51
  // 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
- ["screenReaderChanged", "touchExplorationDidChange"],
60
- ["accessibilityServiceChanged", "accessibilityServiceDidChange"],
61
- ])
62
- : (Platform.OS === "harmony" ?
63
- new Map([
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
- if (Platform.OS === "android") {
97
- return Promise.resolve(false);
98
- } else {
99
- return new Promise((resolve, reject) => {
100
- if (NativeAccessibilityManagerIOS != null) {
101
- NativeAccessibilityManagerIOS.getCurrentBoldTextState(
102
- resolve,
103
- reject
104
- );
105
- } else {
106
- reject(null);
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
- if (Platform.OS === "android") {
122
- return Promise.resolve(false);
123
- } else {
124
- return new Promise((resolve, reject) => {
125
- if (NativeAccessibilityManagerIOS != null) {
126
- NativeAccessibilityManagerIOS.getCurrentGrayscaleState(
127
- resolve,
128
- reject
129
- );
130
- } else {
131
- reject(null);
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
- if (Platform.OS === "android") {
147
- return Promise.resolve(false);
148
- } else {
149
- return new Promise((resolve, reject) => {
150
- if (NativeAccessibilityManagerIOS != null) {
151
- NativeAccessibilityManagerIOS.getCurrentInvertColorsState(
152
- resolve,
153
- reject
154
- );
155
- } else {
156
- reject(null);
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
- return new Promise((resolve, reject) => {
172
- if (Platform.OS === "android") {
173
- if (NativeAccessibilityInfoAndroid != null) {
174
- NativeAccessibilityInfoAndroid.isReduceMotionEnabled(resolve);
175
- } else {
176
- reject(null);
177
- }
178
- } else {
179
- if (NativeAccessibilityManagerIOS != null) {
180
- NativeAccessibilityManagerIOS.getCurrentReduceMotionState(
181
- resolve,
182
- reject
183
- );
184
- } else {
185
- reject(null);
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
- return new Promise((resolve, reject) => {
201
- if (Platform.OS === "android") {
202
- return Promise.resolve(false);
203
- } else {
204
- if (
205
- NativeAccessibilityManagerIOS?.getCurrentPrefersCrossFadeTransitionsState !=
206
- null
207
- ) {
208
- NativeAccessibilityManagerIOS.getCurrentPrefersCrossFadeTransitionsState(
209
- resolve,
210
- reject
211
- );
212
- } else {
213
- reject(null);
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
- 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
- }
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
- return new Promise((resolve, reject) => {
254
- // RNOH: path to support open harmony
255
- if (Platform.OS === "harmony"){
256
- if (NativeAccessibilityManagerHarmony != null) {
257
- NativeAccessibilityManagerHarmony.isTouchExplorationEnabled(resolve);
258
- } else {
259
- reject(null);
260
- }
261
- } else if (Platform.OS === "android" ) {
262
- if (NativeAccessibilityInfoAndroid != null) {
263
- NativeAccessibilityInfoAndroid.isTouchExplorationEnabled(resolve);
264
- } else {
265
- reject(null);
266
- }
267
- } else {
268
- if (NativeAccessibilityManagerIOS != null) {
269
- NativeAccessibilityManagerIOS.getCurrentVoiceOverState(
270
- resolve,
271
- reject
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
- return new Promise((resolve, reject) => {
292
- if (Platform.OS === "harmony") {
293
- if (NativeAccessibilityInfoHarmony != null) {
294
- NativeAccessibilityInfoHarmony.isAccessibilityServiceEnabled(resolve);
295
- } else {
296
- reject(null);
297
- }
298
- } else if (Platform.OS === "android") {
299
- if (
300
- NativeAccessibilityInfoAndroid != null &&
301
- NativeAccessibilityInfoAndroid.isAccessibilityServiceEnabled != null
302
- ) {
303
- NativeAccessibilityInfoAndroid.isAccessibilityServiceEnabled(resolve);
304
- } else {
305
- reject(null);
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
- legacySendAccessibilityEvent(reactTag, "focus");
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 === "ios" && eventType === "click") {
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
- if(Platform.OS === "harmony") {
390
- NativeAccessibilityManagerHarmony?.announceForAccessibility(announcement);
391
- } else if (Platform.OS === "android") {
392
- NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement);
393
- } else {
394
- NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
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
- if (Platform.OS === "android") {
409
- NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement);
410
- } else {
411
- if (NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions) {
412
- NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions(
413
- announcement,
414
- options
415
- );
416
- } else {
417
- NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
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
- if (Platform.OS === "android") {
429
- return new Promise((resolve, reject) => {
430
- if (NativeAccessibilityInfoAndroid?.getRecommendedTimeoutMillis) {
431
- NativeAccessibilityInfoAndroid.getRecommendedTimeoutMillis(
432
- originalTimeout,
433
- resolve
434
- );
435
- } else {
436
- resolve(originalTimeout);
437
- }
438
- });
439
- } else {
440
- return Promise.resolve(originalTimeout);
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
- return NativeImageLoaderHarmony.prefetchImage(url);
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 {
@@ -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('react-native/Libraries/ReactNative/I18nManager');
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-oh/react-native-harmony",
3
- "version": "0.72.38-3",
3
+ "version": "0.72.39-11",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
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;