@react-native-oh/react-native-harmony 0.72.23-3 → 0.72.27

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 (44) hide show
  1. package/Libraries/Alert/Alert.harmony.js +71 -71
  2. package/Libraries/Alert/AlertManager.ts +35 -35
  3. package/Libraries/Animated/NativeAnimatedHelper.harmony.js +601 -601
  4. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.harmony.js +445 -426
  5. package/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.harmony.js +30 -0
  6. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.harmony.js +26 -0
  7. package/Libraries/Components/Button/Button.harmony.js +450 -450
  8. package/Libraries/Components/Image/Image.flow.harmony.js +53 -0
  9. package/Libraries/Components/Image/Image.harmony.js +299 -0
  10. package/Libraries/Components/Image/NativeImageLoaderHarmony.js +38 -0
  11. package/Libraries/Components/RefreshControl/RefreshControl.harmony.js +210 -210
  12. package/Libraries/Components/SafeAreaView/SafeAreaView.harmony.tsx +76 -75
  13. package/Libraries/Components/ScrollView/ScrollView.harmony.js +1951 -1951
  14. package/Libraries/Components/ScrollView/processDecelerationRate.harmony.js +24 -24
  15. package/Libraries/Components/StatusBar/NativeStatusBarManagerHarmony.js +71 -68
  16. package/Libraries/Components/StatusBar/StatusBar.harmony.js +447 -447
  17. package/Libraries/Components/TextInput/TextInput.harmony.js +1707 -1707
  18. package/Libraries/Components/TextInput/TextInputState.harmony.js +220 -220
  19. package/Libraries/Components/Touchable/TouchableHighlight.harmony.js +396 -396
  20. package/Libraries/Components/Touchable/TouchableNativeFeedback.harmony.js +364 -364
  21. package/Libraries/Components/Touchable/TouchableWithoutFeedback.harmony.js +227 -227
  22. package/Libraries/Components/View/View.harmony.js +149 -149
  23. package/Libraries/Core/setUpReactDevTools.harmony.js +93 -93
  24. package/Libraries/Image/AssetSourceResolver.harmony.ts +78 -78
  25. package/Libraries/NativeComponent/BaseViewConfig.harmony.js +337 -337
  26. package/Libraries/ReactNative/UIManager.harmony.js +210 -210
  27. package/Libraries/Settings/Settings.harmony.js +15 -15
  28. package/Libraries/Share/Share.harmony.js +174 -174
  29. package/Libraries/StyleSheet/NativePlatformColor.ts +8 -8
  30. package/Libraries/StyleSheet/PlatformColorValueTypes.harmony.ts +14 -14
  31. package/Libraries/Utilities/BackHandler.harmony.js +109 -109
  32. package/Libraries/Utilities/{NativePlatformConstantsHarmony.ts → NativePlatformConstants.harmony.ts} +8 -8
  33. package/Libraries/Utilities/Platform.d.ts +117 -117
  34. package/Libraries/Utilities/Platform.harmony.ts +33 -33
  35. package/Libraries/Utilities/createPerformanceLogger.harmony.js +328 -328
  36. package/Libraries/Vibration/Vibration.harmony.js +88 -88
  37. package/index.js +212 -212
  38. package/jest.config.js +5 -5
  39. package/metro.config.js +348 -348
  40. package/package.json +57 -57
  41. package/react-native.config.js +10 -10
  42. package/react_native_openharmony.har +0 -0
  43. package/tsconfig.json +13 -13
  44. package/types/index.d.ts +101 -101
@@ -1,220 +1,220 @@
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
- // This class is responsible for coordinating the "focused" state for
12
- // TextInputs. All calls relating to the keyboard should be funneled
13
- // through here.
14
-
15
- // RNOH: patch - update imports
16
-
17
- import type {
18
- HostComponent,
19
- MeasureInWindowOnSuccessCallback,
20
- MeasureLayoutOnSuccessCallback,
21
- MeasureOnSuccessCallback,
22
- } from "react-native/Libraries/Renderer/shims/ReactNativeTypes";
23
-
24
- import { Commands as AndroidTextInputCommands } from "react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent";
25
- import { Commands as iOSTextInputCommands } from "react-native/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent";
26
-
27
- const {
28
- findNodeHandle,
29
- } = require("react-native/Libraries/ReactNative/RendererProxy");
30
- const React = require("react");
31
- type ComponentRef = React.ElementRef<HostComponent<mixed>>;
32
-
33
- // RNOH: patch - replace Platform.OS occurences with hardcoded PlatformOS
34
- const PlatformOS = "ios";
35
-
36
- let currentlyFocusedInputRef: ?ComponentRef = null;
37
- const inputs = new Set<{
38
- blur(): void,
39
- focus(): void,
40
- measure(callback: MeasureOnSuccessCallback): void,
41
- measureInWindow(callback: MeasureInWindowOnSuccessCallback): void,
42
- measureLayout(
43
- relativeToNativeNode: number | React.ElementRef<HostComponent<mixed>>,
44
- onSuccess: MeasureLayoutOnSuccessCallback,
45
- onFail?: () => void
46
- ): void,
47
- setNativeProps(nativeProps: { ... }): void,
48
- }>();
49
-
50
- function currentlyFocusedInput(): ?ComponentRef {
51
- return currentlyFocusedInputRef;
52
- }
53
-
54
- /**
55
- * Returns the ID of the currently focused text field, if one exists
56
- * If no text field is focused it returns null
57
- */
58
- function currentlyFocusedField(): ?number {
59
- if (__DEV__) {
60
- console.error(
61
- "currentlyFocusedField is deprecated and will be removed in a future release. Use currentlyFocusedInput"
62
- );
63
- }
64
-
65
- return findNodeHandle(currentlyFocusedInputRef);
66
- }
67
-
68
- function focusInput(textField: ?ComponentRef): void {
69
- if (currentlyFocusedInputRef !== textField && textField != null) {
70
- currentlyFocusedInputRef = textField;
71
- }
72
- }
73
-
74
- function blurInput(textField: ?ComponentRef): void {
75
- if (currentlyFocusedInputRef === textField && textField != null) {
76
- currentlyFocusedInputRef = null;
77
- }
78
- }
79
-
80
- function focusField(textFieldID: ?number): void {
81
- if (__DEV__) {
82
- console.error("focusField no longer works. Use focusInput");
83
- }
84
-
85
- return;
86
- }
87
-
88
- function blurField(textFieldID: ?number) {
89
- if (__DEV__) {
90
- console.error("blurField no longer works. Use blurInput");
91
- }
92
-
93
- return;
94
- }
95
-
96
- /**
97
- * @param {number} TextInputID id of the text field to focus
98
- * Focuses the specified text field
99
- * noop if the text field was already focused or if the field is not editable
100
- */
101
- function focusTextInput(textField: ?ComponentRef) {
102
- if (typeof textField === "number") {
103
- if (__DEV__) {
104
- console.error(
105
- "focusTextInput must be called with a host component. Passing a react tag is deprecated."
106
- );
107
- }
108
-
109
- return;
110
- }
111
-
112
- if (textField != null) {
113
- const fieldCanBeFocused =
114
- currentlyFocusedInputRef !== textField &&
115
- // $FlowFixMe - `currentProps` is missing in `NativeMethods`
116
- textField.currentProps?.editable !== false;
117
-
118
- if (!fieldCanBeFocused) {
119
- return;
120
- }
121
- focusInput(textField);
122
- if (PlatformOS === "ios") {
123
- // This isn't necessarily a single line text input
124
- // But commands don't actually care as long as the thing being passed in
125
- // actually has a command with that name. So this should work with single
126
- // and multiline text inputs. Ideally we'll merge them into one component
127
- // in the future.
128
- iOSTextInputCommands.focus(textField);
129
- } else if (PlatformOS === "android") {
130
- AndroidTextInputCommands.focus(textField);
131
- }
132
- }
133
- }
134
-
135
- /**
136
- * @param {number} textFieldID id of the text field to unfocus
137
- * Unfocuses the specified text field
138
- * noop if it wasn't focused
139
- */
140
- function blurTextInput(textField: ?ComponentRef) {
141
- if (typeof textField === "number") {
142
- if (__DEV__) {
143
- console.error(
144
- "blurTextInput must be called with a host component. Passing a react tag is deprecated."
145
- );
146
- }
147
-
148
- return;
149
- }
150
-
151
- if (currentlyFocusedInputRef === textField && textField != null) {
152
- blurInput(textField);
153
- if (PlatformOS === "ios") {
154
- // This isn't necessarily a single line text input
155
- // But commands don't actually care as long as the thing being passed in
156
- // actually has a command with that name. So this should work with single
157
- // and multiline text inputs. Ideally we'll merge them into one component
158
- // in the future.
159
- iOSTextInputCommands.blur(textField);
160
- } else if (PlatformOS === "android") {
161
- AndroidTextInputCommands.blur(textField);
162
- }
163
- }
164
- }
165
-
166
- function registerInput(textField: ComponentRef) {
167
- if (typeof textField === "number") {
168
- if (__DEV__) {
169
- console.error(
170
- "registerInput must be called with a host component. Passing a react tag is deprecated."
171
- );
172
- }
173
-
174
- return;
175
- }
176
-
177
- inputs.add(textField);
178
- }
179
-
180
- function unregisterInput(textField: ComponentRef) {
181
- if (typeof textField === "number") {
182
- if (__DEV__) {
183
- console.error(
184
- "unregisterInput must be called with a host component. Passing a react tag is deprecated."
185
- );
186
- }
187
-
188
- return;
189
- }
190
- inputs.delete(textField);
191
- }
192
-
193
- function isTextInput(textField: ComponentRef): boolean {
194
- if (typeof textField === "number") {
195
- if (__DEV__) {
196
- console.error(
197
- "isTextInput must be called with a host component. Passing a react tag is deprecated."
198
- );
199
- }
200
-
201
- return false;
202
- }
203
-
204
- return inputs.has(textField);
205
- }
206
-
207
- module.exports = {
208
- currentlyFocusedInput,
209
- focusInput,
210
- blurInput,
211
-
212
- currentlyFocusedField,
213
- focusField,
214
- blurField,
215
- focusTextInput,
216
- blurTextInput,
217
- registerInput,
218
- unregisterInput,
219
- isTextInput,
220
- };
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
+ // This class is responsible for coordinating the "focused" state for
12
+ // TextInputs. All calls relating to the keyboard should be funneled
13
+ // through here.
14
+
15
+ // RNOH: patch - update imports
16
+
17
+ import type {
18
+ HostComponent,
19
+ MeasureInWindowOnSuccessCallback,
20
+ MeasureLayoutOnSuccessCallback,
21
+ MeasureOnSuccessCallback,
22
+ } from "react-native/Libraries/Renderer/shims/ReactNativeTypes";
23
+
24
+ import { Commands as AndroidTextInputCommands } from "react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent";
25
+ import { Commands as iOSTextInputCommands } from "react-native/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent";
26
+
27
+ const {
28
+ findNodeHandle,
29
+ } = require("react-native/Libraries/ReactNative/RendererProxy");
30
+ const React = require("react");
31
+ type ComponentRef = React.ElementRef<HostComponent<mixed>>;
32
+
33
+ // RNOH: patch - replace Platform.OS occurences with hardcoded PlatformOS
34
+ const PlatformOS = "ios";
35
+
36
+ let currentlyFocusedInputRef: ?ComponentRef = null;
37
+ const inputs = new Set<{
38
+ blur(): void,
39
+ focus(): void,
40
+ measure(callback: MeasureOnSuccessCallback): void,
41
+ measureInWindow(callback: MeasureInWindowOnSuccessCallback): void,
42
+ measureLayout(
43
+ relativeToNativeNode: number | React.ElementRef<HostComponent<mixed>>,
44
+ onSuccess: MeasureLayoutOnSuccessCallback,
45
+ onFail?: () => void
46
+ ): void,
47
+ setNativeProps(nativeProps: { ... }): void,
48
+ }>();
49
+
50
+ function currentlyFocusedInput(): ?ComponentRef {
51
+ return currentlyFocusedInputRef;
52
+ }
53
+
54
+ /**
55
+ * Returns the ID of the currently focused text field, if one exists
56
+ * If no text field is focused it returns null
57
+ */
58
+ function currentlyFocusedField(): ?number {
59
+ if (__DEV__) {
60
+ console.error(
61
+ "currentlyFocusedField is deprecated and will be removed in a future release. Use currentlyFocusedInput"
62
+ );
63
+ }
64
+
65
+ return findNodeHandle(currentlyFocusedInputRef);
66
+ }
67
+
68
+ function focusInput(textField: ?ComponentRef): void {
69
+ if (currentlyFocusedInputRef !== textField && textField != null) {
70
+ currentlyFocusedInputRef = textField;
71
+ }
72
+ }
73
+
74
+ function blurInput(textField: ?ComponentRef): void {
75
+ if (currentlyFocusedInputRef === textField && textField != null) {
76
+ currentlyFocusedInputRef = null;
77
+ }
78
+ }
79
+
80
+ function focusField(textFieldID: ?number): void {
81
+ if (__DEV__) {
82
+ console.error("focusField no longer works. Use focusInput");
83
+ }
84
+
85
+ return;
86
+ }
87
+
88
+ function blurField(textFieldID: ?number) {
89
+ if (__DEV__) {
90
+ console.error("blurField no longer works. Use blurInput");
91
+ }
92
+
93
+ return;
94
+ }
95
+
96
+ /**
97
+ * @param {number} TextInputID id of the text field to focus
98
+ * Focuses the specified text field
99
+ * noop if the text field was already focused or if the field is not editable
100
+ */
101
+ function focusTextInput(textField: ?ComponentRef) {
102
+ if (typeof textField === "number") {
103
+ if (__DEV__) {
104
+ console.error(
105
+ "focusTextInput must be called with a host component. Passing a react tag is deprecated."
106
+ );
107
+ }
108
+
109
+ return;
110
+ }
111
+
112
+ if (textField != null) {
113
+ const fieldCanBeFocused =
114
+ currentlyFocusedInputRef !== textField &&
115
+ // $FlowFixMe - `currentProps` is missing in `NativeMethods`
116
+ textField.currentProps?.editable !== false;
117
+
118
+ if (!fieldCanBeFocused) {
119
+ return;
120
+ }
121
+ focusInput(textField);
122
+ if (PlatformOS === "ios") {
123
+ // This isn't necessarily a single line text input
124
+ // But commands don't actually care as long as the thing being passed in
125
+ // actually has a command with that name. So this should work with single
126
+ // and multiline text inputs. Ideally we'll merge them into one component
127
+ // in the future.
128
+ iOSTextInputCommands.focus(textField);
129
+ } else if (PlatformOS === "android") {
130
+ AndroidTextInputCommands.focus(textField);
131
+ }
132
+ }
133
+ }
134
+
135
+ /**
136
+ * @param {number} textFieldID id of the text field to unfocus
137
+ * Unfocuses the specified text field
138
+ * noop if it wasn't focused
139
+ */
140
+ function blurTextInput(textField: ?ComponentRef) {
141
+ if (typeof textField === "number") {
142
+ if (__DEV__) {
143
+ console.error(
144
+ "blurTextInput must be called with a host component. Passing a react tag is deprecated."
145
+ );
146
+ }
147
+
148
+ return;
149
+ }
150
+
151
+ if (currentlyFocusedInputRef === textField && textField != null) {
152
+ blurInput(textField);
153
+ if (PlatformOS === "ios") {
154
+ // This isn't necessarily a single line text input
155
+ // But commands don't actually care as long as the thing being passed in
156
+ // actually has a command with that name. So this should work with single
157
+ // and multiline text inputs. Ideally we'll merge them into one component
158
+ // in the future.
159
+ iOSTextInputCommands.blur(textField);
160
+ } else if (PlatformOS === "android") {
161
+ AndroidTextInputCommands.blur(textField);
162
+ }
163
+ }
164
+ }
165
+
166
+ function registerInput(textField: ComponentRef) {
167
+ if (typeof textField === "number") {
168
+ if (__DEV__) {
169
+ console.error(
170
+ "registerInput must be called with a host component. Passing a react tag is deprecated."
171
+ );
172
+ }
173
+
174
+ return;
175
+ }
176
+
177
+ inputs.add(textField);
178
+ }
179
+
180
+ function unregisterInput(textField: ComponentRef) {
181
+ if (typeof textField === "number") {
182
+ if (__DEV__) {
183
+ console.error(
184
+ "unregisterInput must be called with a host component. Passing a react tag is deprecated."
185
+ );
186
+ }
187
+
188
+ return;
189
+ }
190
+ inputs.delete(textField);
191
+ }
192
+
193
+ function isTextInput(textField: ComponentRef): boolean {
194
+ if (typeof textField === "number") {
195
+ if (__DEV__) {
196
+ console.error(
197
+ "isTextInput must be called with a host component. Passing a react tag is deprecated."
198
+ );
199
+ }
200
+
201
+ return false;
202
+ }
203
+
204
+ return inputs.has(textField);
205
+ }
206
+
207
+ module.exports = {
208
+ currentlyFocusedInput,
209
+ focusInput,
210
+ blurInput,
211
+
212
+ currentlyFocusedField,
213
+ focusField,
214
+ blurField,
215
+ focusTextInput,
216
+ blurTextInput,
217
+ registerInput,
218
+ unregisterInput,
219
+ isTextInput,
220
+ };