@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
package/index.js ADDED
@@ -0,0 +1,348 @@
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
+ const restoreRemoveListener = require('./compat/restoreRemoveListener');
8
+ const { ensurePropTypes: withPropTypes } = require('./compat/ensurePropTypes');
9
+ const warnOnce = require('@react-native-oh/react-native-harmony/Libraries/Utilities/warnOnce');
10
+
11
+ module.exports = {
12
+ get AccessibilityInfo() {
13
+ const mod =
14
+ require('./Libraries/Components/AccessibilityInfo/AccessibilityInfo').default;
15
+ restoreRemoveListener(mod, 'addEventListener', 'removeEventListener');
16
+ return mod;
17
+ },
18
+ get ActionSheetIOS() {
19
+ return require('@react-native-oh/react-native-harmony/Libraries/ActionSheetIOS/ActionSheetIOS');
20
+ },
21
+ get ActivityIndicator() {
22
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/ActivityIndicator/ActivityIndicator')
23
+ .default;
24
+ },
25
+ get ART() {
26
+ warnOnce(
27
+ 'art-not-supported',
28
+ "react-native-harmony-61-interop doesn't support ART"
29
+ );
30
+ return require('./Libraries/ART/ReactNativeART');
31
+ },
32
+ get Alert() {
33
+ return require('@react-native-oh/react-native-harmony/Libraries/Alert/Alert');
34
+ },
35
+ get Animated() {
36
+ return require('./Libraries/Animated/Animated').default;
37
+ },
38
+ get Appearance() {
39
+ return require('@react-native-oh/react-native-harmony/Libraries/Utilities/Appearance');
40
+ },
41
+ get AppRegistry() {
42
+ return require('@react-native-oh/react-native-harmony/Libraries/ReactNative/AppRegistry');
43
+ },
44
+ get AppState() {
45
+ const mod = require('@react-native-oh/react-native-harmony/Libraries/AppState/AppState');
46
+ restoreRemoveListener(mod, 'addEventListener', 'removeEventListener');
47
+ return mod;
48
+ },
49
+ get BackHandler() {
50
+ const mod =
51
+ require('@react-native-oh/react-native-harmony/Libraries/Utilities/BackHandler').default;
52
+ restoreRemoveListener(mod, 'addEventListener', 'removeEventListener');
53
+ return mod;
54
+ },
55
+ get Button() {
56
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/Button')
57
+ .default;
58
+ },
59
+ get DevSettings() {
60
+ return require('@react-native-oh/react-native-harmony/Libraries/Utilities/DevSettings');
61
+ },
62
+ get Dimensions() {
63
+ const mod =
64
+ require('@react-native-oh/react-native-harmony/Libraries/Utilities/Dimensions').default;
65
+ restoreRemoveListener(mod, 'addEventListener', 'removeEventListener');
66
+ return mod;
67
+ },
68
+ get DeviceEventEmitter() {
69
+ return require('@react-native-oh/react-native-harmony/Libraries/EventEmitter/RCTDeviceEventEmitter')
70
+ .default;
71
+ },
72
+ get DeviceInfo() {
73
+ return require('@react-native-oh/react-native-harmony/Libraries/Utilities/DeviceInfo');
74
+ },
75
+ get DrawerLayoutAndroid() {
76
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid');
77
+ },
78
+ get Easing() {
79
+ return require('@react-native-oh/react-native-harmony/Libraries/Animated/Easing')
80
+ .default;
81
+ },
82
+ get findNodeHandle() {
83
+ return require('@react-native-oh/react-native-harmony/Libraries/ReactNative/RendererProxy')
84
+ .findNodeHandle;
85
+ },
86
+ get FlatList() {
87
+ return require('@react-native-oh/react-native-harmony/Libraries/Lists/FlatList');
88
+ },
89
+ get Image() {
90
+ return withPropTypes(
91
+ require('./Libraries/Image/Image')
92
+ .default
93
+ );
94
+ },
95
+ get ImageBackground() {
96
+ return require('@react-native-oh/react-native-harmony/Libraries/Image/ImageBackground');
97
+ },
98
+ get InputAccessoryView() {
99
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/TextInput/InputAccessoryView')
100
+ .default;
101
+ },
102
+ get I18nManager() {
103
+ return require('@react-native-oh/react-native-harmony/Libraries/ReactNative/I18nManager');
104
+ },
105
+ get LayoutAnimation() {
106
+ return require('@react-native-oh/react-native-harmony/Libraries/LayoutAnimation/LayoutAnimation');
107
+ },
108
+ get Linking() {
109
+ const mod = require('@react-native-oh/react-native-harmony/Libraries/Linking/Linking');
110
+ restoreRemoveListener(mod, 'addEventListener', 'removeEventListener');
111
+ return mod;
112
+ },
113
+ get LogBox() {
114
+ return require('@react-native-oh/react-native-harmony/Libraries/LogBox/LogBox')
115
+ .default;
116
+ },
117
+ get Modal() {
118
+ return require('@react-native-oh/react-native-harmony/Libraries/Modal/Modal');
119
+ },
120
+ get Keyboard() {
121
+ const mod = require('@react-native-oh/react-native-harmony/Libraries/Components/Keyboard/Keyboard');
122
+ restoreRemoveListener(mod, 'addListener', 'removeListener');
123
+ return mod;
124
+ },
125
+ get KeyboardAvoidingView() {
126
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/Keyboard/KeyboardAvoidingView')
127
+ .default;
128
+ },
129
+ get NativeEventEmitter() {
130
+ return require('./Libraries/EventEmitter/NativeEventEmitter');
131
+ },
132
+ get NativeModules() {
133
+ return require('@react-native-oh/react-native-harmony/Libraries/BatchedBridge/NativeModules');
134
+ },
135
+ get Picker() {
136
+ return require('./Libraries/Components/Picker/Picker').default;
137
+ },
138
+ get PickerIOS() {
139
+ return require('./Libraries/Components/PickerIOS/PickerIOS')
140
+ .default;
141
+ },
142
+ get PixelRatio() {
143
+ return require('@react-native-oh/react-native-harmony/Libraries/Utilities/PixelRatio')
144
+ .default;
145
+ },
146
+ get Platform() {
147
+ return require('./Libraries/Utilities/Platform.harmony.ts');
148
+ },
149
+ get PlatformColor() {
150
+ return require('@react-native-oh/react-native-harmony/Libraries/StyleSheet/PlatformColorValueTypes')
151
+ .PlatformColor;
152
+ },
153
+ get Pressable() {
154
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/Pressable/Pressable')
155
+ .default;
156
+ },
157
+ get RefreshControl() {
158
+ return require('./Libraries/Components/RefreshControl/RefreshControl')
159
+ .default;
160
+ },
161
+ get requireNativeComponent() {
162
+ return require('@react-native-oh/react-native-harmony/Libraries/ReactNative/requireNativeComponent')
163
+ .default;
164
+ },
165
+ get RootTagContext() {
166
+ return require('@react-native-oh/react-native-harmony/Libraries/ReactNative/RootTag')
167
+ .RootTagContext;
168
+ },
169
+ get SafeAreaView() {
170
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/SafeAreaView/SafeAreaView')
171
+ .default;
172
+ },
173
+ get SegmentedControlIOS() {
174
+ return require('./Libraries/Components/SegmentedControlIOS/SegmentedControlIOS');
175
+ },
176
+ get Settings() {
177
+ return require('@react-native-oh/react-native-harmony/Libraries/Settings/Settings')
178
+ .default;
179
+ },
180
+ get Share() {
181
+ return require('@react-native-oh/react-native-harmony/Libraries/Share/Share');
182
+ },
183
+ get ScrollView() {
184
+ return require('./Libraries/Components/ScrollView/ScrollView').default;
185
+ },
186
+ get StatusBar() {
187
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/StatusBar/StatusBar');
188
+ },
189
+ get StyleSheet() {
190
+ return require('@react-native-oh/react-native-harmony/Libraries/StyleSheet/StyleSheet');
191
+ },
192
+ get Switch() {
193
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/Switch/Switch')
194
+ .default;
195
+ },
196
+ get Systrace() {
197
+ return require('@react-native-oh/react-native-harmony/Libraries/Performance/Systrace');
198
+ },
199
+ get Text() {
200
+ return withPropTypes(
201
+ require('@react-native-oh/react-native-harmony/Libraries/Text/Text')
202
+ );
203
+ },
204
+ get TextInput() {
205
+ return withPropTypes(
206
+ require('./Libraries/Components/TextInput/TextInput').default
207
+ );
208
+ },
209
+ get ToastAndroid() {
210
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/ToastAndroid/ToastAndroid.android');
211
+ },
212
+ get Touchable() {
213
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/Touchable/Touchable')
214
+ .default;
215
+ },
216
+ get TouchableHighlight() {
217
+ return withPropTypes(
218
+ require('@react-native-oh/react-native-harmony/Libraries/Components/Touchable/TouchableHighlight')
219
+ );
220
+ },
221
+ get TouchableNativeFeedback() {
222
+ return withPropTypes(
223
+ require('@react-native-oh/react-native-harmony/Libraries/Components/Touchable/TouchableNativeFeedback')
224
+ );
225
+ },
226
+ get TouchableOpacity() {
227
+ return withPropTypes(
228
+ require('./Libraries/Components/Touchable/TouchableOpacity')
229
+ );
230
+ },
231
+ get TouchableWithoutFeedback() {
232
+ return withPropTypes(
233
+ require('@react-native-oh/react-native-harmony/Libraries/Components/Touchable/TouchableWithoutFeedback')
234
+ );
235
+ },
236
+ get TurboModuleRegistry() {
237
+ return require('@react-native-oh/react-native-harmony/Libraries/TurboModule/TurboModuleRegistry');
238
+ },
239
+ get TVEventHandler() {
240
+ return require('./Libraries/Components/AppleTV/TVEventHandler');
241
+ },
242
+ get UIManager() {
243
+ return require('@react-native-oh/react-native-harmony/Libraries/ReactNative/UIManager');
244
+ },
245
+ get unstable_batchedUpdates() {
246
+ return require('@react-native-oh/react-native-harmony/Libraries/ReactNative/RendererProxy')
247
+ .unstable_batchedUpdates;
248
+ },
249
+ get useAnimatedValue() {
250
+ return require('@react-native-oh/react-native-harmony/Libraries/Animated/useAnimatedValue')
251
+ .default;
252
+ },
253
+ get useColorScheme() {
254
+ return require('@react-native-oh/react-native-harmony/Libraries/Utilities/useColorScheme')
255
+ .default;
256
+ },
257
+ get useWindowDimensions() {
258
+ return require('@react-native-oh/react-native-harmony/Libraries/Utilities/useWindowDimensions')
259
+ .default;
260
+ },
261
+ get View() {
262
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/View/View');
263
+ },
264
+ get InteractionManager() {
265
+ return require('@react-native-oh/react-native-harmony/Libraries/Interaction/InteractionManager');
266
+ },
267
+ get PanResponder() {
268
+ return require('@react-native-oh/react-native-harmony/Libraries/Interaction/PanResponder')
269
+ .default;
270
+ },
271
+ get processColor() {
272
+ return require('@react-native-oh/react-native-harmony/Libraries/StyleSheet/processColor')
273
+ .default;
274
+ },
275
+ get SectionList() {
276
+ return require('@react-native-oh/react-native-harmony/Libraries/Lists/SectionList')
277
+ .default;
278
+ },
279
+ get Vibration() {
280
+ return require('@react-native-oh/react-native-harmony/Libraries/Vibration/Vibration');
281
+ },
282
+ get VirtualizedList() {
283
+ return require('@react-native-oh/react-native-harmony/Libraries/Lists/VirtualizedList');
284
+ },
285
+ // BEGIN: react-native-harmony specific exports
286
+ get registerViewConfig() {
287
+ return require('@react-native-oh/react-native-harmony/Libraries/Renderer/shims/ReactNativeViewConfigRegistry')
288
+ .register;
289
+ },
290
+ get ReactNativeViewAttributes() {
291
+ return require('@react-native-oh/react-native-harmony/Libraries/Components/View/ReactNativeViewAttributes');
292
+ },
293
+ get dispatchCommand() {
294
+ return require('@react-native-oh/react-native-harmony/Libraries/Renderer/shims/ReactNative')
295
+ .default.dispatchCommand;
296
+ },
297
+ // END: react-native-harmony specific exports
298
+ // BEGIN: 61 specific exports
299
+ get AsyncStorage() {
300
+ return require('./Libraries/Storage').default;
301
+ },
302
+ get CheckBox() {
303
+ return require('./Libraries/Components/CheckBox/CheckBox').default;
304
+ },
305
+ get MaskedViewIOS() {
306
+ return require('./Libraries/Components/MaskedView/MaskedView').default;
307
+ },
308
+ get TimePickerAndroid() {
309
+ return require('./Libraries/Components/TimePickerAndroid/TimePickerAndroid')
310
+ .default;
311
+ },
312
+ get DatePickerIOS() {
313
+ return require('./Libraries/Components/DatePickerIOS/DatePickerIOS')
314
+ .default;
315
+ },
316
+ get DatePickerAndroid() {
317
+ return require('./Libraries/Components/DatePickerAndroid/DatePickerAndroid')
318
+ .default;
319
+ },
320
+ get ProgressViewIOS() {
321
+ return require('./Libraries/Components/ProgressViewIOS/ProgressViewIOS')
322
+ .default;
323
+ },
324
+ get ProgressBarAndroid() {
325
+ return require('./Libraries/Components/ProgressBarAndroid/ProgressBarAndroid')
326
+ .default;
327
+ },
328
+ // Top-level legacy RN61 PropTypes exports
329
+ get ColorPropType() {
330
+ return require('./Libraries/DeprecatedPropTypes/DeprecatedColorPropType');
331
+ },
332
+ get EdgeInsetsPropType() {
333
+ return require('./Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType');
334
+ },
335
+ get PointPropType() {
336
+ return require('./Libraries/DeprecatedPropTypes/DeprecatedPointPropType');
337
+ },
338
+ get ViewPropTypes() {
339
+ return require('./Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes');
340
+ },
341
+ get PushNotificationIOS() {
342
+ return require('./Libraries/Components/PushNotificationIOS/PushNotificationIOS').default;
343
+ },
344
+ get Slider() {
345
+ return require('./Libraries/Components/Slider/Slider').default;
346
+ },
347
+ // END: 61 specific exports
348
+ };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@react-native-oh/react-native-harmony",
3
+ "version": "0.61.16",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "publishConfig": {
7
+ "access": "public",
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
10
+ "scripts": {
11
+ "setup": "pnpm codegen-lib",
12
+ "prepack": "pnpm build",
13
+ "build": "pnpm codegen-lib && node ./scripts/build-har.js",
14
+ "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --turbo-modules-spec-paths ./src/private/specs/ --arkts-components-spec-paths ./src/private/specs/components --npm-package-name react-native-harmony-61-interop --cpp-output-path ../react-native-harmony-61-interop-tester/rnoh-entry/harmony/react_native_harmony_61_interop/src/main/cpp/generated --ets-output-path ../react-native-harmony-61-interop-tester/rnoh-entry/harmony/react_native_harmony_61_interop/src/main/ets/generated"
15
+ },
16
+ "files": [
17
+ "compat",
18
+ "harmony",
19
+ "Libraries",
20
+ "patched-virtualized-list",
21
+ "polyfills",
22
+ "src",
23
+ "index.js",
24
+ "README.md",
25
+ "./react_native_harmony.har"
26
+ ],
27
+ "keywords": [],
28
+ "author": "",
29
+ "dependencies": {
30
+ "nullthrows": "^1.1.1"
31
+ },
32
+ "peerDependencies": {
33
+ "@react-native-oh/react-native-harmony": ">=0.77.0"
34
+ },
35
+ "license": "MIT",
36
+ "harmony": {
37
+ "alias": "@react-native-oh/react-native-harmony",
38
+ "redirectInternalImports": true,
39
+ "autolinking": {
40
+ "ohPackageName": "@rnoh/react-native-openharmony-61-interop",
41
+ "cppPackageClassName": "ReactNativeHarmony61InteropPackage",
42
+ "cmakeLibraryTargetName": "rnoh_interop_61"
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,87 @@
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
+ 'use strict';
9
+
10
+ /**
11
+ * Patch description:
12
+ *
13
+ * This patch modifies VirtualizedList for interop to resolve
14
+ * inconsistencies between React Native 0.61 and 0.77. The primary issue affects
15
+ * the logic that triggers `onEndReached`.
16
+ *
17
+ * In RN 0.77, the old `_maybeCallOnEndReached` method (RN 0.61) was replaced by
18
+ * `_maybeCallOnEdgeReached`, which handles both `onStartReached` and
19
+ * `onEndReached`. The `_hasDataChangedSinceEndReached` flag
20
+ * was removed. That flag previously prevented `onEndReached` from firing multiple
21
+ * times under certain conditions, and its removal changed scroll behavior in ways
22
+ * that break compatibility.
23
+ *
24
+ * To restore consistent behavior, this patch re-introduces the 0.61 logic:
25
+ * - `_hasDataChangedSinceEndReached` is added back.
26
+ * - `onEndReached` is called with 0.61 conditions.
27
+ * - The `onStartReached` logic is removed, as it did not exist in 0.61.
28
+ * - componentDidUpdate is overwritten to set the flag `_hasDataChangedSinceEndReached`
29
+ *
30
+ */
31
+
32
+ const {
33
+ VirtualizedList: BaseVirtualizedList,
34
+ } = require('@react-native/virtualized-lists');
35
+
36
+ class VirtualizedList extends BaseVirtualizedList {
37
+ _maybeCallOnEdgeReached() {
38
+ const {
39
+ data,
40
+ getItemCount,
41
+ onEndReached,
42
+ onEndReachedThreshold
43
+ } = this.props;
44
+
45
+ const { visibleLength, offset } = this._scrollMetrics;
46
+
47
+ const distanceFromEnd =
48
+ this._listMetrics.getContentLength() - visibleLength - offset;
49
+
50
+ const DEFAULT_THRESHOLD_PX = 2;
51
+
52
+ const endThreshold =
53
+ onEndReachedThreshold != null
54
+ ? onEndReachedThreshold * visibleLength
55
+ : DEFAULT_THRESHOLD_PX;
56
+
57
+ if (
58
+ onEndReached &&
59
+ this.state.cellsAroundViewport.last === getItemCount(data) - 1 &&
60
+ distanceFromEnd <= endThreshold &&
61
+ (this._hasDataChangedSinceEndReached ||
62
+ this._scrollMetrics.contentLength !==
63
+ this._sentEndForContentLength)
64
+ ) {
65
+ // Only call onEndReached once for a given dataset + content length.
66
+ this._hasDataChangedSinceEndReached = false;
67
+ this._sentEndForContentLength = this._scrollMetrics.contentLength;
68
+
69
+ onEndReached({ distanceFromEnd });
70
+ }
71
+ }
72
+
73
+ componentDidUpdate(prevProps) {
74
+ const {data, extraData} = this.props;
75
+ if (data !== prevProps.data || extraData !== prevProps.extraData) {
76
+ this._hasDataChangedSinceEndReached = true;
77
+ }
78
+
79
+ super.componentDidUpdate(prevProps);
80
+ }
81
+
82
+ // flag that was present in 0.61 but was later removed needed for the onEndReached logic
83
+ _hasDataChangedSinceEndReached = true;
84
+ }
85
+
86
+ module.exports = VirtualizedList;
87
+ module.exports.default = VirtualizedList;
@@ -0,0 +1,89 @@
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
+ 'use strict';
8
+
9
+ // Polyfill for parsing 'YYYY/MM/DD' as local time (matching legacy JSC).
10
+ // Enabled by importing this module.
11
+
12
+ (function () {
13
+ try {
14
+ const {
15
+ polyfillGlobal,
16
+ } = require('@react-native-oh/react-native-harmony/Libraries/Utilities/PolyfillFunctions');
17
+
18
+ const OrigDate = global.Date;
19
+
20
+ // Feature probe: if engine already parses slashes, do nothing
21
+ const supportsSlash = !Number.isNaN(OrigDate.parse('2000/01/02'));
22
+ if (supportsSlash) {
23
+ return;
24
+ }
25
+
26
+ function parseSlash(s) {
27
+ if (typeof s !== 'string') {
28
+ return null;
29
+ }
30
+ const m = /^(\d{4})\/(\d{2})\/(\d{2})$/.exec(s);
31
+ if (!m) {
32
+ return null;
33
+ }
34
+ const y = parseInt(m[1], 10);
35
+ const mo = parseInt(m[2], 10);
36
+ const d = parseInt(m[3], 10);
37
+ // Local midnight to mirror JSC behavior for 'YYYY/MM/DD'
38
+ return new OrigDate(y, mo - 1, d).getTime();
39
+ }
40
+
41
+ polyfillGlobal('Date', () => {
42
+ const origParse = OrigDate.parse;
43
+
44
+ // Constructor wrapper
45
+ const PatchedDate = function DatePolyfill(...args) {
46
+ // If called with `new`, construct
47
+ if (new.target) {
48
+ if (args.length === 1 && typeof args[0] === 'string') {
49
+ const n = parseSlash(args[0]);
50
+ if (n != null) {
51
+ return new OrigDate(n);
52
+ }
53
+ }
54
+ return new OrigDate(...args);
55
+ }
56
+ // If called as a function, behave like native Date()
57
+ return OrigDate.apply(OrigDate, args);
58
+ };
59
+
60
+ PatchedDate.prototype = OrigDate.prototype;
61
+
62
+ // Copy static properties (UTC, now, parse, etc.)
63
+ Object.getOwnPropertyNames(OrigDate).forEach(k => {
64
+ if (!(k in PatchedDate)) {
65
+ PatchedDate[k] = OrigDate[k];
66
+ }
67
+ });
68
+
69
+ // Patch parse to support only exact 'YYYY/MM/DD'; delegate otherwise
70
+ PatchedDate.parse = function (s) {
71
+ const n = parseSlash(s);
72
+ if (n != null) {
73
+ return n;
74
+ }
75
+ return origParse(s);
76
+ };
77
+
78
+ return PatchedDate;
79
+ });
80
+ } catch (e) {
81
+ // Fail closed; never crash app due to polyfill
82
+ try {
83
+ const msg =
84
+ '[dateSlash] Failed to initialize Date polyfill: ' +
85
+ String(e && e.message ? e.message : e);
86
+ console.warn(msg);
87
+ } catch (_) {}
88
+ }
89
+ })();
Binary file
@@ -0,0 +1,37 @@
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 type { TurboModule } from "react-native";
9
+ import { TurboModuleRegistry } from "react-native";
10
+ import type { ErrorLike } from "../../../Libraries/Storage/types";
11
+
12
+ export interface Spec extends TurboModule {
13
+ multiGet: (
14
+ keys: string[],
15
+ callback: (error?: ErrorLike[], result?: [string, string][]) => void
16
+ ) => void;
17
+ multiSet: (
18
+ kvPairs: [string, string][],
19
+ callback: (error?: ErrorLike[]) => void
20
+ ) => void;
21
+ multiRemove: (
22
+ keys: readonly string[],
23
+ callback: (error?: ErrorLike[]) => void
24
+ ) => void;
25
+ multiMerge: (
26
+ kvPairs: [string, string][],
27
+ callback: (error?: ErrorLike[]) => void
28
+ ) => void;
29
+ getAllKeys: (
30
+ callback: (error?: ErrorLike[], result?: [string, string][]) => void
31
+ ) => void;
32
+ clear: (callback: (error?: ErrorLike[]) => void) => void;
33
+ }
34
+
35
+ export default TurboModuleRegistry.getEnforcing<Spec>("RNAsyncStorage");
36
+
37
+
@@ -0,0 +1,27 @@
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 type { TurboModule } from "react-native";
9
+ import { TurboModuleRegistry } from "react-native";
10
+
11
+ import type { Double } from "react-native/Libraries/Types/CodegenTypes";
12
+
13
+ type Result =
14
+ | { action: "dateSetAction"; year: number; month: number; day: number }
15
+ | { action: "dismissedAction" };
16
+
17
+ export type Options = {
18
+ date?: Double;
19
+ minDate?: Double;
20
+ maxDate?: Double;
21
+ mode: string; // "calendar" | "spinner" | "default";
22
+ };
23
+ interface Spec extends TurboModule {
24
+ open(opts?: Options): Promise<Result>;
25
+ }
26
+
27
+ export default TurboModuleRegistry.getEnforcing<Spec>("RNDatePickerAndroid");
@@ -0,0 +1,28 @@
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 type { TurboModule } from "react-native";
9
+ import { TurboModuleRegistry } from "react-native";
10
+
11
+ import type { Double } from "react-native/Libraries/Types/CodegenTypes";
12
+
13
+ type Result =
14
+ | { action: "timeSetAction"; hour: number; minute: number }
15
+ | { action: "dismissedAction" };
16
+
17
+ export type Options = {
18
+ hour?: Double;
19
+ minute?: Double;
20
+ is24Hour: boolean;
21
+ mode: string; // "clock" | "spinner" | "default";
22
+ };
23
+
24
+ interface Spec extends TurboModule {
25
+ open(opts?: Options): Promise<Result>;
26
+ }
27
+
28
+ export default TurboModuleRegistry.getEnforcing<Spec>("RNTimePickerAndroid");