@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,227 +1,227 @@
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
- // RNOH patch: disable view flattening
12
-
13
- import type {
14
- AccessibilityActionEvent,
15
- AccessibilityActionInfo,
16
- AccessibilityRole,
17
- AccessibilityState,
18
- AccessibilityValue,
19
- } from "react-native/Libraries/Components/View/ViewAccessibility";
20
- import type { EdgeInsetsOrSizeProp } from "react-native/Libraries/StyleSheet/EdgeInsetsPropType";
21
- import type {
22
- BlurEvent,
23
- FocusEvent,
24
- LayoutEvent,
25
- PressEvent,
26
- } from "react-native/Libraries/Types/CoreEventTypes";
27
-
28
- import View from "react-native/Libraries/Components/View/View";
29
- import Pressability, {
30
- type PressabilityConfig,
31
- } from "react-native/Libraries/Pressability/Pressability";
32
- import { PressabilityDebugView } from "react-native/Libraries/Pressability/PressabilityDebug";
33
- import * as React from "react";
34
-
35
- type Props = $ReadOnly<{|
36
- accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
37
- accessibilityElementsHidden?: ?boolean,
38
- accessibilityHint?: ?Stringish,
39
- accessibilityLanguage?: ?Stringish,
40
- accessibilityIgnoresInvertColors?: ?boolean,
41
- accessibilityLabel?: ?Stringish,
42
- accessibilityLiveRegion?: ?("none" | "polite" | "assertive"),
43
- accessibilityRole?: ?AccessibilityRole,
44
- accessibilityState?: ?AccessibilityState,
45
- accessibilityValue?: ?AccessibilityValue,
46
- "aria-valuemax"?: AccessibilityValue["max"],
47
- "aria-valuemin"?: AccessibilityValue["min"],
48
- "aria-valuenow"?: AccessibilityValue["now"],
49
- "aria-valuetext"?: AccessibilityValue["text"],
50
- accessibilityViewIsModal?: ?boolean,
51
- "aria-modal"?: ?boolean,
52
- accessible?: ?boolean,
53
- /**
54
- * alias for accessibilityState
55
- *
56
- * see https://reactnative.dev/docs/accessibility#accessibilitystate
57
- */
58
- "aria-busy"?: ?boolean,
59
- "aria-checked"?: ?boolean | "mixed",
60
- "aria-disabled"?: ?boolean,
61
- "aria-expanded"?: ?boolean,
62
- "aria-selected"?: ?boolean,
63
- "aria-hidden"?: ?boolean,
64
- "aria-live"?: ?("polite" | "assertive" | "off"),
65
- "aria-label"?: ?Stringish,
66
- children?: ?React.Node,
67
- delayLongPress?: ?number,
68
- delayPressIn?: ?number,
69
- delayPressOut?: ?number,
70
- disabled?: ?boolean,
71
- focusable?: ?boolean,
72
- hitSlop?: ?EdgeInsetsOrSizeProp,
73
- id?: string,
74
- importantForAccessibility?: ?("auto" | "yes" | "no" | "no-hide-descendants"),
75
- nativeID?: ?string,
76
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
77
- onBlur?: ?(event: BlurEvent) => mixed,
78
- onFocus?: ?(event: FocusEvent) => mixed,
79
- onLayout?: ?(event: LayoutEvent) => mixed,
80
- onLongPress?: ?(event: PressEvent) => mixed,
81
- onPress?: ?(event: PressEvent) => mixed,
82
- onPressIn?: ?(event: PressEvent) => mixed,
83
- onPressOut?: ?(event: PressEvent) => mixed,
84
- pressRetentionOffset?: ?EdgeInsetsOrSizeProp,
85
- rejectResponderTermination?: ?boolean,
86
- testID?: ?string,
87
- touchSoundDisabled?: ?boolean,
88
- |}>;
89
-
90
- type State = $ReadOnly<{|
91
- pressability: Pressability,
92
- |}>;
93
-
94
- const PASSTHROUGH_PROPS = [
95
- "accessibilityActions",
96
- "accessibilityElementsHidden",
97
- "accessibilityHint",
98
- "accessibilityLanguage",
99
- "accessibilityIgnoresInvertColors",
100
- "accessibilityLabel",
101
- "accessibilityLiveRegion",
102
- "accessibilityRole",
103
- "accessibilityValue",
104
- "aria-valuemax",
105
- "aria-valuemin",
106
- "aria-valuenow",
107
- "aria-valuetext",
108
- "accessibilityViewIsModal",
109
- "aria-modal",
110
- "hitSlop",
111
- "importantForAccessibility",
112
- "nativeID",
113
- "onAccessibilityAction",
114
- "onBlur",
115
- "onFocus",
116
- "onLayout",
117
- "testID",
118
- ];
119
-
120
- class TouchableWithoutFeedback extends React.Component<Props, State> {
121
- state: State = {
122
- pressability: new Pressability(createPressabilityConfig(this.props)),
123
- };
124
-
125
- render(): React.Node {
126
- const element = React.Children.only<$FlowFixMe>(this.props.children);
127
- const children: Array<React.Node> = [element.props.children];
128
- const ariaLive = this.props["aria-live"];
129
-
130
- if (__DEV__) {
131
- if (element.type === View) {
132
- children.push(
133
- <PressabilityDebugView color="red" hitSlop={this.props.hitSlop} />
134
- );
135
- }
136
- }
137
-
138
- let _accessibilityState = {
139
- busy: this.props["aria-busy"] ?? this.props.accessibilityState?.busy,
140
- checked:
141
- this.props["aria-checked"] ?? this.props.accessibilityState?.checked,
142
- disabled:
143
- this.props["aria-disabled"] ?? this.props.accessibilityState?.disabled,
144
- expanded:
145
- this.props["aria-expanded"] ?? this.props.accessibilityState?.expanded,
146
- selected:
147
- this.props["aria-selected"] ?? this.props.accessibilityState?.selected,
148
- };
149
-
150
- // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before
151
- // adopting `Pressability`, so preserve that behavior.
152
- const { onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus } =
153
- this.state.pressability.getEventHandlers();
154
-
155
- const elementProps: { [string]: mixed, ... } = {
156
- ...eventHandlersWithoutBlurAndFocus,
157
- accessible: this.props.accessible !== false,
158
- accessibilityState:
159
- this.props.disabled != null
160
- ? {
161
- ..._accessibilityState,
162
- disabled: this.props.disabled,
163
- }
164
- : _accessibilityState,
165
- focusable:
166
- this.props.focusable !== false && this.props.onPress !== undefined,
167
-
168
- accessibilityElementsHidden:
169
- this.props["aria-hidden"] ?? this.props.accessibilityElementsHidden,
170
- importantForAccessibility:
171
- this.props["aria-hidden"] === true
172
- ? "no-hide-descendants"
173
- : this.props.importantForAccessibility,
174
- accessibilityLiveRegion:
175
- ariaLive === "off"
176
- ? "none"
177
- : ariaLive ?? this.props.accessibilityLiveRegion,
178
- nativeID: this.props.id ?? this.props.nativeID,
179
- collapsable: false, // RNOH: patch
180
- };
181
- for (const prop of PASSTHROUGH_PROPS) {
182
- if (this.props[prop] !== undefined) {
183
- elementProps[prop] = this.props[prop];
184
- }
185
- }
186
-
187
- return React.cloneElement(element, elementProps, ...children);
188
- }
189
-
190
- componentDidUpdate(): void {
191
- this.state.pressability.configure(createPressabilityConfig(this.props));
192
- }
193
-
194
- componentWillUnmount(): void {
195
- this.state.pressability.reset();
196
- }
197
- }
198
-
199
- function createPressabilityConfig({
200
- "aria-disabled": ariaDisabled,
201
- ...props
202
- }: Props): PressabilityConfig {
203
- const accessibilityStateDisabled =
204
- ariaDisabled ?? props.accessibilityState?.disabled;
205
- return {
206
- cancelable: !props.rejectResponderTermination,
207
- disabled:
208
- props.disabled !== null ? props.disabled : accessibilityStateDisabled,
209
- hitSlop: props.hitSlop,
210
- delayLongPress: props.delayLongPress,
211
- delayPressIn: props.delayPressIn,
212
- delayPressOut: props.delayPressOut,
213
- minPressDuration: 0,
214
- pressRectOffset: props.pressRetentionOffset,
215
- android_disableSound: props.touchSoundDisabled,
216
- onBlur: props.onBlur,
217
- onFocus: props.onFocus,
218
- onLongPress: props.onLongPress,
219
- onPress: props.onPress,
220
- onPressIn: props.onPressIn,
221
- onPressOut: props.onPressOut,
222
- };
223
- }
224
-
225
- TouchableWithoutFeedback.displayName = "TouchableWithoutFeedback";
226
-
227
- module.exports = TouchableWithoutFeedback;
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
+ // RNOH patch: disable view flattening
12
+
13
+ import type {
14
+ AccessibilityActionEvent,
15
+ AccessibilityActionInfo,
16
+ AccessibilityRole,
17
+ AccessibilityState,
18
+ AccessibilityValue,
19
+ } from "react-native/Libraries/Components/View/ViewAccessibility";
20
+ import type { EdgeInsetsOrSizeProp } from "react-native/Libraries/StyleSheet/EdgeInsetsPropType";
21
+ import type {
22
+ BlurEvent,
23
+ FocusEvent,
24
+ LayoutEvent,
25
+ PressEvent,
26
+ } from "react-native/Libraries/Types/CoreEventTypes";
27
+
28
+ import View from "react-native/Libraries/Components/View/View";
29
+ import Pressability, {
30
+ type PressabilityConfig,
31
+ } from "react-native/Libraries/Pressability/Pressability";
32
+ import { PressabilityDebugView } from "react-native/Libraries/Pressability/PressabilityDebug";
33
+ import * as React from "react";
34
+
35
+ type Props = $ReadOnly<{|
36
+ accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
37
+ accessibilityElementsHidden?: ?boolean,
38
+ accessibilityHint?: ?Stringish,
39
+ accessibilityLanguage?: ?Stringish,
40
+ accessibilityIgnoresInvertColors?: ?boolean,
41
+ accessibilityLabel?: ?Stringish,
42
+ accessibilityLiveRegion?: ?("none" | "polite" | "assertive"),
43
+ accessibilityRole?: ?AccessibilityRole,
44
+ accessibilityState?: ?AccessibilityState,
45
+ accessibilityValue?: ?AccessibilityValue,
46
+ "aria-valuemax"?: AccessibilityValue["max"],
47
+ "aria-valuemin"?: AccessibilityValue["min"],
48
+ "aria-valuenow"?: AccessibilityValue["now"],
49
+ "aria-valuetext"?: AccessibilityValue["text"],
50
+ accessibilityViewIsModal?: ?boolean,
51
+ "aria-modal"?: ?boolean,
52
+ accessible?: ?boolean,
53
+ /**
54
+ * alias for accessibilityState
55
+ *
56
+ * see https://reactnative.dev/docs/accessibility#accessibilitystate
57
+ */
58
+ "aria-busy"?: ?boolean,
59
+ "aria-checked"?: ?boolean | "mixed",
60
+ "aria-disabled"?: ?boolean,
61
+ "aria-expanded"?: ?boolean,
62
+ "aria-selected"?: ?boolean,
63
+ "aria-hidden"?: ?boolean,
64
+ "aria-live"?: ?("polite" | "assertive" | "off"),
65
+ "aria-label"?: ?Stringish,
66
+ children?: ?React.Node,
67
+ delayLongPress?: ?number,
68
+ delayPressIn?: ?number,
69
+ delayPressOut?: ?number,
70
+ disabled?: ?boolean,
71
+ focusable?: ?boolean,
72
+ hitSlop?: ?EdgeInsetsOrSizeProp,
73
+ id?: string,
74
+ importantForAccessibility?: ?("auto" | "yes" | "no" | "no-hide-descendants"),
75
+ nativeID?: ?string,
76
+ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
77
+ onBlur?: ?(event: BlurEvent) => mixed,
78
+ onFocus?: ?(event: FocusEvent) => mixed,
79
+ onLayout?: ?(event: LayoutEvent) => mixed,
80
+ onLongPress?: ?(event: PressEvent) => mixed,
81
+ onPress?: ?(event: PressEvent) => mixed,
82
+ onPressIn?: ?(event: PressEvent) => mixed,
83
+ onPressOut?: ?(event: PressEvent) => mixed,
84
+ pressRetentionOffset?: ?EdgeInsetsOrSizeProp,
85
+ rejectResponderTermination?: ?boolean,
86
+ testID?: ?string,
87
+ touchSoundDisabled?: ?boolean,
88
+ |}>;
89
+
90
+ type State = $ReadOnly<{|
91
+ pressability: Pressability,
92
+ |}>;
93
+
94
+ const PASSTHROUGH_PROPS = [
95
+ "accessibilityActions",
96
+ "accessibilityElementsHidden",
97
+ "accessibilityHint",
98
+ "accessibilityLanguage",
99
+ "accessibilityIgnoresInvertColors",
100
+ "accessibilityLabel",
101
+ "accessibilityLiveRegion",
102
+ "accessibilityRole",
103
+ "accessibilityValue",
104
+ "aria-valuemax",
105
+ "aria-valuemin",
106
+ "aria-valuenow",
107
+ "aria-valuetext",
108
+ "accessibilityViewIsModal",
109
+ "aria-modal",
110
+ "hitSlop",
111
+ "importantForAccessibility",
112
+ "nativeID",
113
+ "onAccessibilityAction",
114
+ "onBlur",
115
+ "onFocus",
116
+ "onLayout",
117
+ "testID",
118
+ ];
119
+
120
+ class TouchableWithoutFeedback extends React.Component<Props, State> {
121
+ state: State = {
122
+ pressability: new Pressability(createPressabilityConfig(this.props)),
123
+ };
124
+
125
+ render(): React.Node {
126
+ const element = React.Children.only<$FlowFixMe>(this.props.children);
127
+ const children: Array<React.Node> = [element.props.children];
128
+ const ariaLive = this.props["aria-live"];
129
+
130
+ if (__DEV__) {
131
+ if (element.type === View) {
132
+ children.push(
133
+ <PressabilityDebugView color="red" hitSlop={this.props.hitSlop} />
134
+ );
135
+ }
136
+ }
137
+
138
+ let _accessibilityState = {
139
+ busy: this.props["aria-busy"] ?? this.props.accessibilityState?.busy,
140
+ checked:
141
+ this.props["aria-checked"] ?? this.props.accessibilityState?.checked,
142
+ disabled:
143
+ this.props["aria-disabled"] ?? this.props.accessibilityState?.disabled,
144
+ expanded:
145
+ this.props["aria-expanded"] ?? this.props.accessibilityState?.expanded,
146
+ selected:
147
+ this.props["aria-selected"] ?? this.props.accessibilityState?.selected,
148
+ };
149
+
150
+ // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before
151
+ // adopting `Pressability`, so preserve that behavior.
152
+ const { onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus } =
153
+ this.state.pressability.getEventHandlers();
154
+
155
+ const elementProps: { [string]: mixed, ... } = {
156
+ ...eventHandlersWithoutBlurAndFocus,
157
+ accessible: this.props.accessible !== false,
158
+ accessibilityState:
159
+ this.props.disabled != null
160
+ ? {
161
+ ..._accessibilityState,
162
+ disabled: this.props.disabled,
163
+ }
164
+ : _accessibilityState,
165
+ focusable:
166
+ this.props.focusable !== false && this.props.onPress !== undefined,
167
+
168
+ accessibilityElementsHidden:
169
+ this.props["aria-hidden"] ?? this.props.accessibilityElementsHidden,
170
+ importantForAccessibility:
171
+ this.props["aria-hidden"] === true
172
+ ? "no-hide-descendants"
173
+ : this.props.importantForAccessibility,
174
+ accessibilityLiveRegion:
175
+ ariaLive === "off"
176
+ ? "none"
177
+ : ariaLive ?? this.props.accessibilityLiveRegion,
178
+ nativeID: this.props.id ?? this.props.nativeID,
179
+ collapsable: false, // RNOH: patch
180
+ };
181
+ for (const prop of PASSTHROUGH_PROPS) {
182
+ if (this.props[prop] !== undefined) {
183
+ elementProps[prop] = this.props[prop];
184
+ }
185
+ }
186
+
187
+ return React.cloneElement(element, elementProps, ...children);
188
+ }
189
+
190
+ componentDidUpdate(): void {
191
+ this.state.pressability.configure(createPressabilityConfig(this.props));
192
+ }
193
+
194
+ componentWillUnmount(): void {
195
+ this.state.pressability.reset();
196
+ }
197
+ }
198
+
199
+ function createPressabilityConfig({
200
+ "aria-disabled": ariaDisabled,
201
+ ...props
202
+ }: Props): PressabilityConfig {
203
+ const accessibilityStateDisabled =
204
+ ariaDisabled ?? props.accessibilityState?.disabled;
205
+ return {
206
+ cancelable: !props.rejectResponderTermination,
207
+ disabled:
208
+ props.disabled !== null ? props.disabled : accessibilityStateDisabled,
209
+ hitSlop: props.hitSlop,
210
+ delayLongPress: props.delayLongPress,
211
+ delayPressIn: props.delayPressIn,
212
+ delayPressOut: props.delayPressOut,
213
+ minPressDuration: 0,
214
+ pressRectOffset: props.pressRetentionOffset,
215
+ android_disableSound: props.touchSoundDisabled,
216
+ onBlur: props.onBlur,
217
+ onFocus: props.onFocus,
218
+ onLongPress: props.onLongPress,
219
+ onPress: props.onPress,
220
+ onPressIn: props.onPressIn,
221
+ onPressOut: props.onPressOut,
222
+ };
223
+ }
224
+
225
+ TouchableWithoutFeedback.displayName = "TouchableWithoutFeedback";
226
+
227
+ module.exports = TouchableWithoutFeedback;