@react-native-oh/react-native-harmony 0.61.16

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.
Files changed (82) hide show
  1. package/Libraries/ART/ReactNativeART.js +43 -0
  2. package/Libraries/Animated/Animated.js +154 -0
  3. package/Libraries/Animated/delegates/createAnimatedComponentDelegate.js +20 -0
  4. package/Libraries/Animated/src/Easing.js +20 -0
  5. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +15 -0
  6. package/Libraries/Components/AppleTV/TVEventHandler.js +13 -0
  7. package/Libraries/Components/CheckBox/CheckBox.tsx +182 -0
  8. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.tsx +32 -0
  9. package/Libraries/Components/DatePickerIOS/DatePickerIOS.tsx +285 -0
  10. package/Libraries/Components/MaskedView/MaskedView.tsx +32 -0
  11. package/Libraries/Components/Picker/Picker.tsx +303 -0
  12. package/Libraries/Components/PickerIOS/PickerIOS.tsx +175 -0
  13. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.tsx +156 -0
  14. package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.tsx +65 -0
  15. package/Libraries/Components/PushNotificationIOS/PushNotificationIOS.tsx +609 -0
  16. package/Libraries/Components/RefreshControl/RefreshControl.tsx +54 -0
  17. package/Libraries/Components/ScrollView/ScrollView.js +34 -0
  18. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.tsx +79 -0
  19. package/Libraries/Components/Slider/Slider.tsx +204 -0
  20. package/Libraries/Components/TextInput/TextInput.js +24 -0
  21. package/Libraries/Components/TimePickerAndroid/TimePickerAndroid.tsx +20 -0
  22. package/Libraries/Components/Touchable/TouchableOpacity.js +90 -0
  23. package/Libraries/Components/View/ViewPropTypes.js +16 -0
  24. package/Libraries/Components/View/delegate/ViewDelegate.js +49 -0
  25. package/Libraries/Core/ReactNativeVersion.js +21 -0
  26. package/Libraries/Core/polyfillPromise.js +18 -0
  27. package/Libraries/Core/setUpPlatform.js +13 -0
  28. package/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js +16 -0
  29. package/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js +16 -0
  30. package/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.js +15 -0
  31. package/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js +16 -0
  32. package/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js +15 -0
  33. package/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js +15 -0
  34. package/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js +16 -0
  35. package/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js +15 -0
  36. package/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js +16 -0
  37. package/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js +15 -0
  38. package/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js +15 -0
  39. package/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js +16 -0
  40. package/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js +15 -0
  41. package/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js +15 -0
  42. package/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js +15 -0
  43. package/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js +16 -0
  44. package/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js +15 -0
  45. package/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js +20 -0
  46. package/Libraries/EventEmitter/NativeEventEmitter.js +50 -0
  47. package/Libraries/Image/Image.tsx +88 -0
  48. package/Libraries/Promise.js +50 -0
  49. package/Libraries/Storage/AsyncStorage.ts +216 -0
  50. package/Libraries/Storage/helpers.ts +36 -0
  51. package/Libraries/Storage/hooks.ts +19 -0
  52. package/Libraries/Storage/index.ts +5 -0
  53. package/Libraries/Storage/types.ts +43 -0
  54. package/Libraries/StyleSheet/EdgeInsetsPropType.js +15 -0
  55. package/Libraries/StyleSheet/PointPropType.js +15 -0
  56. package/Libraries/Utilities/Platform.harmony.ts +68 -0
  57. package/Libraries/Utilities/setAndForwardRef.js +71 -0
  58. package/README.dev.md +55 -0
  59. package/README.md +146 -0
  60. package/compat/ensurePropTypes.js +45 -0
  61. package/compat/getNoopPropType.js +42 -0
  62. package/compat/restoreRemoveListener.js +117 -0
  63. package/index.js +348 -0
  64. package/package.json +45 -0
  65. package/patched-virtualized-list/VirtualizedList.js +87 -0
  66. package/polyfills/dateSlash.js +89 -0
  67. package/react_native_harmony.har +0 -0
  68. package/src/private/specs/AsyncStorage.ts +37 -0
  69. package/src/private/specs/NativeDatePickerAndroid.ts +27 -0
  70. package/src/private/specs/NativeTimePickerAndroid.ts +28 -0
  71. package/src/private/specs/PushNotificationIOS.ts +167 -0
  72. package/src/private/specs/components/CheckBoxNativeComponent.ts +35 -0
  73. package/src/private/specs/components/DatePickerNativeComponent.ts +40 -0
  74. package/src/private/specs/components/MaskedViewNativeComponent.ts +17 -0
  75. package/src/private/specs/components/PickerIOSNativeComponent.ts +53 -0
  76. package/src/private/specs/components/PickerNativeComponent.ts +67 -0
  77. package/src/private/specs/components/ProgressBarNativeComponent.ts +24 -0
  78. package/src/private/specs/components/ProgressViewNativeComponent.ts +24 -0
  79. package/src/private/specs/components/ProgressWheelNativeComponent.ts +18 -0
  80. package/src/private/specs/components/RNSliderNativeComponent.ts +44 -0
  81. package/src/private/specs/components/SegmentedControlNativeComponent.ts +38 -0
  82. package/src/private/specs/components/TimePickerNativeComponent.ts +40 -0
@@ -0,0 +1,609 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its 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
+ * NOTICE: This file is copied from @react-native-ohos/push-notification-ios and adapted.
11
+ *
12
+ * PushNotificationIOS-ios was initially part of the RN hence such copyright header is used.
13
+ * This component was later extracted and moved to a separate library.
14
+ * The copyright header above is also used in the react-native-community version, but the community version is converted to TypeScript.
15
+ * @react-native-ohos/push-notification-ios is based on from react-native-community and slightly adapted for OHOS.
16
+ */
17
+
18
+ "use strict";
19
+
20
+ import { NativeEventEmitter } from "react-native";
21
+ import invariant from "invariant";
22
+ import type {
23
+ NotificationAlert,
24
+ NotificationRequest,
25
+ NotificationCategory,
26
+ } from "../../../src/private/specs/PushNotificationIOS";
27
+ import RNCPushNotificationIOS from "../../../src/private/specs/PushNotificationIOS";
28
+
29
+ const PushNotificationEmitter = new NativeEventEmitter(RNCPushNotificationIOS);
30
+
31
+ const _notifHandlers = new Map();
32
+
33
+ const DEVICE_NOTIF_EVENT = "remoteNotificationReceived";
34
+ const NOTIF_REGISTER_EVENT = "remoteNotificationsRegistered";
35
+ const NOTIF_REGISTRATION_ERRorOR_EVENT = "remoteNotificationRegistrationError";
36
+ const DEVICE_LOCAL_NOTIF_EVENT = "localNotificationReceived";
37
+
38
+ export type ContentAvailable = 1 | null | void;
39
+
40
+ class PushNotificationIOS {
41
+ _data: Record<string, any>;
42
+ _alert?: string | NotificationAlert;
43
+ _title?: string;
44
+ _subtitle?: string;
45
+ _sound?: string;
46
+ _category?: string;
47
+ _contentAvailable?: ContentAvailable;
48
+ _badgeCount?: number;
49
+ _notificationId?: string;
50
+ /**
51
+ * The id of action the user has taken taken.
52
+ */
53
+ _actionIdentifier: string | undefined;
54
+ /**
55
+ * The text user has input if user responded with a text action.
56
+ */
57
+ _userText: string | undefined;
58
+ _isRemote: boolean;
59
+ _remoteNotificationCompleteCallbackCalled: boolean;
60
+ _threadID?: string;
61
+ _fireDate?: string | Date;
62
+
63
+ /**
64
+ * You will never need to instantiate `PushNotificationIOS` yourself.
65
+ * Listening to the `notification` event and invoking
66
+ * `getInitialNotification` is sufficient
67
+ *
68
+ */
69
+ constructor(nativeNotif: any) {
70
+ this._data = {};
71
+ this._remoteNotificationCompleteCallbackCalled = false;
72
+ this._isRemote = nativeNotif.remote;
73
+ if (this._isRemote) {
74
+ this._notificationId = nativeNotif.notificationId;
75
+ }
76
+
77
+ this._actionIdentifier = nativeNotif.actionIdentifier;
78
+ this._userText = nativeNotif.userText;
79
+ if (nativeNotif.remote) {
80
+ // Extract data from Apple's `aps` dict as defined:
81
+ // https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
82
+ Object.keys(nativeNotif).forEach((notifKey) => {
83
+ const notifVal = nativeNotif[notifKey];
84
+
85
+ if (notifKey === "aps") {
86
+ this._alert = notifVal.alert;
87
+ this._title = notifVal?.alertTitle;
88
+ this._subtitle = notifVal?.subtitle;
89
+ this._sound = notifVal.sound;
90
+ this._badgeCount = notifVal.badge;
91
+ this._category = notifVal.category;
92
+ this._contentAvailable = notifVal["content-available"];
93
+ this._threadID = notifVal["thread-id"];
94
+ this._fireDate = notifVal.fireDate;
95
+ } else {
96
+ this._data[notifKey] = notifVal;
97
+ }
98
+ });
99
+ } else {
100
+ // Local notifications aren't being sent down with `aps` dict.
101
+ // TODO: remove applicationIconBadgeNumber on next major version
102
+ this._badgeCount =
103
+ nativeNotif.badge || nativeNotif.applicationIconBadgeNumber;
104
+ // TODO: remove soundName on next major version
105
+ this._sound = nativeNotif.sound || nativeNotif.soundName;
106
+ this._alert = nativeNotif.body;
107
+ this._title = nativeNotif?.title;
108
+ this._subtitle = nativeNotif?.subtitle;
109
+ this._threadID = nativeNotif["thread-id"];
110
+ this._data = nativeNotif.userInfo;
111
+ this._category = nativeNotif.category;
112
+ this._fireDate = nativeNotif.fireDate;
113
+ }
114
+ }
115
+
116
+ /**
117
+ * This method is available for remote notifications that have been received via:
118
+ * `application:didReceiveRemoteNotification:fetchCompletionHandler:`
119
+ *
120
+ * See https://reactnative.dev/docs/pushnotificationios.html#finish
121
+ */
122
+ finish(fetchResult: string) {
123
+ if (
124
+ !this._isRemote ||
125
+ !this._notificationId ||
126
+ this._remoteNotificationCompleteCallbackCalled
127
+ ) {
128
+ return;
129
+ }
130
+ this._remoteNotificationCompleteCallbackCalled = true;
131
+
132
+ invariant(
133
+ RNCPushNotificationIOS,
134
+ "PushNotificationManager is not available."
135
+ );
136
+
137
+ console.error("PushNotificationIOS.finish is not implmented");
138
+ }
139
+
140
+ /**
141
+ * An alias for `getAlert` to get the notification's main message string
142
+ */
143
+ getMessage(): string | object | undefined {
144
+ if (typeof this._alert === "object") {
145
+ return this._alert?.body;
146
+ }
147
+ return this._alert;
148
+ }
149
+
150
+ /**
151
+ * Gets the sound string from the `aps` object
152
+ *
153
+ * See https://reactnative.dev/docs/pushnotificationios.html#getsound
154
+ */
155
+ getSound(): string | undefined {
156
+ return this._sound;
157
+ }
158
+
159
+ /**
160
+ * Gets the category string from the `aps` object
161
+ *
162
+ * See https://reactnative.dev/docs/pushnotificationios.html#getcategory
163
+ */
164
+ getCategory(): string | undefined {
165
+ return this._category;
166
+ }
167
+
168
+ /**
169
+ * Gets the notification's main message from the `aps` object
170
+ *
171
+ * See https://reactnative.dev/docs/pushnotificationios.html#getalert
172
+ */
173
+ getAlert(): string | object | undefined {
174
+ return this._alert;
175
+ }
176
+
177
+ /**
178
+ * Gets the notification's title from the `aps` object
179
+ *
180
+ */
181
+ getTitle(): string | object | undefined {
182
+ if (typeof this._alert === "object") {
183
+ return this._alert?.title;
184
+ }
185
+ return this._title;
186
+ }
187
+
188
+ /**
189
+ * Gets the notification's subtitle from the `aps` object
190
+ *
191
+ */
192
+ getSubtitle(): string | object | undefined {
193
+ if (typeof this._alert === "object") {
194
+ return this._alert?.subtitle;
195
+ }
196
+ return this._subtitle;
197
+ }
198
+
199
+ /**
200
+ * Gets the content-available number from the `aps` object
201
+ *
202
+ * See https://reactnative.dev/docs/pushnotificationios.html#getcontentavailable
203
+ */
204
+ getContentAvailable(): ContentAvailable {
205
+ return this._contentAvailable;
206
+ }
207
+
208
+ /**
209
+ * Gets the badge count number from the `aps` object
210
+ *
211
+ * See https://reactnative.dev/docs/pushnotificationios.html#getbadgecount
212
+ */
213
+ getBadgeCount(): number | undefined {
214
+ return this._badgeCount;
215
+ }
216
+
217
+ /**
218
+ * Gets the data object on the notif
219
+ *
220
+ * See https://reactnative.dev/docs/pushnotificationios.html#getdata
221
+ */
222
+ getData(): object | undefined {
223
+ return this._data;
224
+ }
225
+
226
+ /**
227
+ * Gets the thread ID on the notif
228
+ *
229
+ * See https://reactnative.dev/docs/pushnotificationios.html#getthreadid
230
+ */
231
+ getThreadID(): string | undefined {
232
+ return this._threadID;
233
+ }
234
+
235
+ /**
236
+ * Get's the action id of the notification action user has taken.
237
+ */
238
+ getActionIdentifier(): string | undefined {
239
+ return this._actionIdentifier;
240
+ }
241
+
242
+ /**
243
+ * Gets the text user has inputed if user has taken the text action response.
244
+ */
245
+ getUserText(): string | undefined {
246
+ return this._userText;
247
+ }
248
+ }
249
+
250
+ /**
251
+ *
252
+ * Handle push notifications for your app, including permission handling and
253
+ * icon badge number.
254
+ *
255
+ * See https://reactnative.dev/docs/pushnotificationios.html
256
+ */
257
+ export default {
258
+ /**
259
+ * Sends notificationRequest to notification center at specified firedate.
260
+ * Fires immediately if firedate is not set.
261
+ */
262
+ addNotificationRequest(request: NotificationRequest) {
263
+ const finalRequest = {
264
+ ...request,
265
+ repeatsComponent: request.repeatsComponent || {},
266
+ };
267
+
268
+ RNCPushNotificationIOS.addNotificationRequest(finalRequest);
269
+ },
270
+
271
+ /**
272
+ * Remove all delivered notifications from Notification Center.
273
+ *
274
+ * See https://reactnative.dev/docs/pushnotificationios.html#removealldeliverednotifications
275
+ */
276
+ removeAllDeliveredNotifications() {
277
+ invariant(
278
+ RNCPushNotificationIOS,
279
+ "PushNotificationManager is not available."
280
+ );
281
+ RNCPushNotificationIOS.removeAllDeliveredNotifications();
282
+ },
283
+
284
+ /**
285
+ * Provides you with a list of the app’s notifications that are still displayed in Notification Center.
286
+ *
287
+ * See https://reactnative.dev/docs/pushnotificationios.html#getdeliverednotifications
288
+ */
289
+ getDeliveredNotifications(callback: (notifications: Object[]) => void) {
290
+ invariant(
291
+ RNCPushNotificationIOS,
292
+ "PushNotificationManager is not available."
293
+ );
294
+ RNCPushNotificationIOS.getDeliveredNotifications(callback);
295
+ },
296
+
297
+ /**
298
+ * Removes the specified notifications from Notification Center
299
+ *
300
+ * See https://reactnative.dev/docs/pushnotificationios.html#removedeliverednotifications
301
+ */
302
+ removeDeliveredNotifications(identifiers: string[]) {
303
+ invariant(
304
+ RNCPushNotificationIOS,
305
+ "PushNotificationManager is not available."
306
+ );
307
+ RNCPushNotificationIOS.removeDeliveredNotifications(identifiers);
308
+ },
309
+
310
+ /**
311
+ * Sets the badge number for the app icon on the home screen.
312
+ *
313
+ * See https://reactnative.dev/docs/pushnotificationios.html#setapplicationiconbadgenumber
314
+ */
315
+ setApplicationIconBadgeNumber(number: number) {
316
+ invariant(
317
+ RNCPushNotificationIOS,
318
+ "PushNotificationManager is not available."
319
+ );
320
+ RNCPushNotificationIOS.setApplicationIconBadgeNumber(number);
321
+ },
322
+
323
+ /**
324
+ * Attaches a listener to remote or local notification events while the app
325
+ * is running in the foreground or the background.
326
+ *
327
+ * See https://reactnative.dev/docs/pushnotificationios.html#addeventlistener
328
+ */
329
+ addEventListener(type: any, handler: Function) {
330
+ invariant(
331
+ type === "notification" ||
332
+ type === "register" ||
333
+ type === "registrationError" ||
334
+ type === "localNotification",
335
+ "PushNotificationIOS only supports `notification`, `register`, `registrationError`, and `localNotification` events"
336
+ );
337
+ let listener;
338
+ if (type === "notification") {
339
+ listener = PushNotificationEmitter.addListener(
340
+ DEVICE_NOTIF_EVENT,
341
+ (notifData) => {
342
+ handler(new PushNotificationIOS(notifData));
343
+ }
344
+ );
345
+ } else if (type === "localNotification") {
346
+ listener = PushNotificationEmitter.addListener(
347
+ DEVICE_LOCAL_NOTIF_EVENT,
348
+ (notifData) => {
349
+ handler(new PushNotificationIOS(notifData));
350
+ }
351
+ );
352
+ } else if (type === "register") {
353
+ listener = PushNotificationEmitter.addListener(
354
+ NOTIF_REGISTER_EVENT,
355
+ (registrationInfo) => {
356
+ handler(registrationInfo.deviceToken);
357
+ }
358
+ );
359
+ } else if (type === "registrationError") {
360
+ listener = PushNotificationEmitter.addListener(
361
+ NOTIF_REGISTRATION_ERRorOR_EVENT,
362
+ (errorInfo) => {
363
+ handler(errorInfo);
364
+ }
365
+ );
366
+ }
367
+ _notifHandlers.set(type, listener);
368
+ },
369
+
370
+ /**
371
+ * Removes the event listener. Do this in `componentWillUnmount` to prevent
372
+ * memory leaks.
373
+ *
374
+ * See https://reactnative.dev/docs/pushnotificationios.html#removeeventlistener
375
+ */
376
+ removeEventListener(type: any) {
377
+ invariant(
378
+ type === "notification" ||
379
+ type === "register" ||
380
+ type === "registrationError" ||
381
+ type === "localNotification",
382
+ "PushNotificationIOS only supports `notification`, `register`, `registrationError`, and `localNotification` events"
383
+ );
384
+ const listener = _notifHandlers.get(type);
385
+ if (!listener) {
386
+ return;
387
+ }
388
+ listener.remove();
389
+ _notifHandlers.delete(type);
390
+ },
391
+
392
+ /**
393
+ * See what push permissions are currently enabled. `callback` will be
394
+ * invoked with a `permissions` object.
395
+ *
396
+ * See https://reactnative.dev/docs/pushnotificationios.html#checkpermissions
397
+ */
398
+ checkPermissions(
399
+ callback: (permision: {
400
+ alert: boolean;
401
+ badge: boolean;
402
+ sound: boolean;
403
+ }) => {}
404
+ ) {
405
+ invariant(typeof callback === "function", "Must provide a valid callback");
406
+ invariant(
407
+ RNCPushNotificationIOS,
408
+ "PushNotificationManager is not available."
409
+ );
410
+
411
+ RNCPushNotificationIOS.checkPermissions(callback);
412
+ },
413
+
414
+ // NOT IMPLEMENTED
415
+
416
+ /**
417
+ * Requests notification permissions from iOS, prompting the user's
418
+ * dialog box. By default, it will request all notification permissions, but
419
+ * a subset of these can be requested by passing a map of requested
420
+ * permissions.
421
+ *
422
+ * See https://reactnative.dev/docs/pushnotificationios.html#requestpermissions
423
+ */
424
+ requestPermissions(permissions?: {
425
+ alert?: boolean;
426
+ badge?: boolean;
427
+ sound?: boolean;
428
+ critical?: boolean;
429
+ }): Promise<{
430
+ alert: boolean;
431
+ badge: boolean;
432
+ sound: boolean;
433
+ critical: boolean;
434
+ }> {
435
+ invariant(
436
+ RNCPushNotificationIOS,
437
+ "PushNotificationManager is not available."
438
+ );
439
+ console.error("PushNotificationIOS.requestPermissions is not implmented");
440
+ return new Promise(() => ({
441
+ alert: false,
442
+ badge: false,
443
+ sound: false,
444
+ critical: false,
445
+ }));
446
+ },
447
+
448
+ /**
449
+ * Sets notification category to notification center.
450
+ * Used to set specific actions for notifications that contains specified category
451
+ */
452
+ setNotificationCategories(categories: NotificationCategory[]) {
453
+ console.error(
454
+ "PushNotificationIOS.setNotificationCategories is not implmented"
455
+ );
456
+ },
457
+
458
+ /**
459
+ * Removes all pending notifications
460
+ */
461
+ removeAllPendingNotificationRequests() {
462
+ invariant(
463
+ RNCPushNotificationIOS,
464
+ "PushNotificationManager is not available."
465
+ );
466
+ console.error(
467
+ "PushNotificationIOS.removeAllPendingNotificationRequests is not implmented"
468
+ );
469
+ },
470
+
471
+ /**
472
+ * Removes pending notifications with given identifier strings.
473
+ */
474
+ removePendingNotificationRequests(identifiers: string[]) {
475
+ invariant(
476
+ RNCPushNotificationIOS,
477
+ "PushNotificationManager is not available."
478
+ );
479
+ console.error(
480
+ "PushNotificationIOS.removePendingNotificationRequests is not implmented"
481
+ );
482
+ },
483
+
484
+ /**
485
+ * Gets the current badge number for the app icon on the home screen.
486
+ *
487
+ * See https://reactnative.dev/docs/pushnotificationios.html#getapplicationiconbadgenumber
488
+ */
489
+ getApplicationIconBadgeNumber(callback: Function) {
490
+ invariant(
491
+ RNCPushNotificationIOS,
492
+ "PushNotificationManager is not available."
493
+ );
494
+ console.error(
495
+ "PushNotificationIOS.getApplicationIconBadgeNumber is not implmented"
496
+ );
497
+ },
498
+
499
+ /**
500
+ * Gets the pending local notification requests.
501
+ */
502
+ getPendingNotificationRequests(
503
+ callback: (requests: NotificationRequest[]) => void
504
+ ) {
505
+ invariant(
506
+ RNCPushNotificationIOS,
507
+ "PushNotificationManager is not available."
508
+ );
509
+ console.error(
510
+ "PushNotificationIOS.getPendingNotificationRequests is not implmented"
511
+ );
512
+ },
513
+
514
+ /**
515
+ * This method returns a promise that resolves to either the notification
516
+ * object if the app was launched by a push notification, or `null` otherwise.
517
+ *
518
+ * See https://reactnative.dev/docs/pushnotificationios.html#getinitialnotification
519
+ */
520
+ getInitialNotification(): Promise<PushNotificationIOS | undefined> {
521
+ invariant(
522
+ RNCPushNotificationIOS,
523
+ "PushNotificationManager is not available."
524
+ );
525
+ console.error(
526
+ "PushNotificationIOS.getInitialNotification is not implmented"
527
+ );
528
+ return new Promise(() => {});
529
+ },
530
+
531
+ /**
532
+ * Unregister for all remote notifications received via Apple Push Notification service.
533
+ *
534
+ * See https://reactnative.dev/docs/pushnotificationios.html#abandonpermissions
535
+ */
536
+ abandonPermissions() {
537
+ invariant(
538
+ RNCPushNotificationIOS,
539
+ "PushNotificationManager is not available."
540
+ );
541
+ console.error("PushNotificationIOS.abandonPermissions is not implmented");
542
+ },
543
+
544
+ // DEPRECATED
545
+
546
+ /**
547
+ * Schedules the localNotification for immediate presentation.
548
+ * @deprecated use `addNotificationRequest` instead
549
+ */
550
+ presentLocalNotification(details: Object) {
551
+ console.error(
552
+ "PushNotificationIOS.presentLocalNotification is deprecated, use addNotificationRequest instead"
553
+ );
554
+ },
555
+
556
+ /**
557
+ * Schedules the localNotification for future presentation.
558
+ * @deprecated use `addNotificationRequest` instead
559
+ */
560
+ scheduleLocalNotification(details: Object) {
561
+ console.error(
562
+ "PushNotificationIOS.scheduleLocalNotification is deprecated, use addNotificationRequest instead"
563
+ );
564
+ },
565
+
566
+ /**
567
+ * Cancels all scheduled localNotifications.
568
+ * @deprecated use `removeAllPendingNotificationRequests` instead
569
+ * - This method is deprecated in iOS 10 and will be removed from future release
570
+ */
571
+ cancelAllLocalNotifications() {
572
+ invariant(
573
+ RNCPushNotificationIOS,
574
+ "PushNotificationManager is not available."
575
+ );
576
+ console.error(
577
+ "PushNotificationIOS.cancelAllLocalNotifications is depricated, use removeAllPendingNotificationRequests instead"
578
+ );
579
+ },
580
+
581
+ /**
582
+ * Cancel local notifications.
583
+ * @deprecated - use `removePendingNotifications`
584
+ * See https://reactnative.dev/docs/pushnotificationios.html#cancellocalnotification
585
+ */
586
+ cancelLocalNotifications(userInfo: Object) {
587
+ invariant(
588
+ RNCPushNotificationIOS,
589
+ "PushNotificationManager is not available."
590
+ );
591
+ console.error(
592
+ "PushNotificationIOS.cancelLocalNotifications is depricated, use removePendingNotifications instead"
593
+ );
594
+ },
595
+
596
+ /**
597
+ * Gets the local notifications that are currently scheduled.
598
+ * @deprecated - use `getPendingNotificationRequests`
599
+ */
600
+ getScheduledLocalNotifications(callback: Function) {
601
+ invariant(
602
+ RNCPushNotificationIOS,
603
+ "PushNotificationManager is not available."
604
+ );
605
+ console.error(
606
+ "PushNotificationIOS.getScheduledLocalNotifications is deprecated, use getPendingNotificationRequests instead"
607
+ );
608
+ },
609
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright (c) 2025 Huawei Technologies Co., Ltd.
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
+
8
+ /**
9
+ * [INTEROP-WRAPPER]
10
+ * Wraps Harmony RefreshControl to adapt RN 0.61 semantics.
11
+ * The `size` prop is the only user-facing change between 0.61 and 0.77
12
+ * For reference on the usage of the old values, see:
13
+ * - RN 0.61 official docs: https://reactnative-archive-august-2023.netlify.app/docs/0.61/refreshcontrol#size
14
+ * - RN 0.64 official docs listing the explicit mapping of `size` on Android: https://reactnative-archive-august-2023.netlify.app/docs/0.64/refreshcontrol#refreshlayoutconstssize
15
+ * - RN 0.6x changelog listing commits where the type of the prop changed: https://github.com/facebook/react-native/blob/main/CHANGELOG-0.6x.md?plain=1#L1091
16
+ */
17
+ import React from "react";
18
+ import RNOHRefreshControl from "@react-native-oh/react-native-harmony/Libraries/Components/RefreshControl/RefreshControl";
19
+
20
+ const RefreshLayoutSize = {
21
+ LARGE: 0,
22
+ DEFAULT: 1,
23
+ } as const;
24
+
25
+ // Exact enum values taken from RN 0.64 docs, see file doc for link
26
+ type Size61 =
27
+ | RefreshLayoutSize.LARGE
28
+ | RefreshLayoutSize.DEFAULT
29
+ | null
30
+ | undefined;
31
+
32
+ type RNOHRefreshControlSize = "default" | "large" | null | undefined;
33
+
34
+ function adaptSize61(old: Size61): RNOHRefreshControlSize {
35
+ switch (old) {
36
+ case RefreshLayoutSize.LARGE:
37
+ case "large":
38
+ return "large";
39
+ case RefreshLayoutSize.DEFAULT:
40
+ case "default":
41
+ default:
42
+ return "default";
43
+ }
44
+ }
45
+
46
+ const RefreshControl = React.forwardRef(({ size, ...props }, ref) => {
47
+ return <RNOHRefreshControl ref={ref} size={adaptSize61(size)} {...props} />;
48
+ });
49
+
50
+ // Export the enum to the user
51
+ RefreshControl.SIZE = RefreshLayoutSize;
52
+ RefreshControl.displayName = "RefreshControl";
53
+
54
+ export default RefreshControl;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) 2025 Huawei Technologies Co., Ltd.
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
+
8
+ import React, { useRef, useImperativeHandle, forwardRef } from 'react';
9
+ import RNOHScrollView from '@react-native-oh/react-native-harmony/Libraries/Components/ScrollView/ScrollView';
10
+
11
+ /**
12
+ * Wrapps RNOHScrollView to add scrollWithoutAnimationTo method
13
+ */
14
+ const ScrollView = forwardRef((props, ref) => {
15
+ const scrollViewRef = useRef(null);
16
+
17
+ useImperativeHandle(ref, () => ({
18
+ scrollWithoutAnimationTo: (y, x) => {
19
+ scrollViewRef.current?.scrollTo({ x, y, animated: false });
20
+ },
21
+ setNativeProps: (nativeProps) => {
22
+ scrollViewRef.current?.setNativeProps(nativeProps);
23
+ },
24
+ ...scrollViewRef.current
25
+ }));
26
+
27
+ return <RNOHScrollView ref={scrollViewRef} {...props} />;
28
+ });
29
+
30
+ ScrollView.displayName = 'ScrollView';
31
+ ScrollView.Context = RNOHScrollView.Context;
32
+
33
+ module.exports = ScrollView;
34
+ module.exports.default = ScrollView;