@office-iss/react-native-win32 0.74.3 → 0.75.0-preview.1

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 (206) hide show
  1. package/.flowconfig +9 -4
  2. package/CHANGELOG.json +563 -45
  3. package/CHANGELOG.md +169 -26
  4. package/Libraries/Animated/AnimatedImplementation.js +2 -0
  5. package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
  6. package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
  7. package/Libraries/Animated/createAnimatedComponent.js +10 -4
  8. package/Libraries/Animated/useAnimatedProps.js +56 -28
  9. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  10. package/Libraries/Components/Button.js +10 -5
  11. package/Libraries/Components/Button.win32.js +1 -0
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
  13. package/Libraries/Components/Pressable/Pressable.js +13 -6
  14. package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
  15. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
  16. package/Libraries/Components/ScrollView/ScrollView.js +109 -29
  17. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
  18. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
  19. package/Libraries/Components/StatusBar/StatusBar.js +1 -21
  20. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
  21. package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
  22. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
  23. package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
  24. package/Libraries/Components/TextInput/TextInput.js +20 -73
  25. package/Libraries/Components/TextInput/TextInput.win32.js +21 -75
  26. package/Libraries/Components/Touchable/Touchable.js +2 -2
  27. package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
  28. package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
  29. package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
  30. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
  31. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
  32. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
  33. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
  34. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  35. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  36. package/Libraries/Components/View/View.js +0 -11
  37. package/Libraries/Components/View/View.win32.js +0 -11
  38. package/Libraries/Components/View/ViewAccessibility.js +4 -4
  39. package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
  40. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  41. package/Libraries/Components/View/ViewPropTypes.js +7 -0
  42. package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
  43. package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
  44. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
  45. package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
  46. package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
  47. package/Libraries/Core/ErrorHandlers.js +116 -0
  48. package/Libraries/Core/ExceptionsManager.js +2 -2
  49. package/Libraries/Core/ReactNativeVersion.js +3 -3
  50. package/Libraries/Core/setUpDeveloperTools.js +3 -1
  51. package/Libraries/Core/setUpPerformance.js +6 -4
  52. package/Libraries/Core/setUpReactDevTools.js +70 -10
  53. package/Libraries/Core/setUpTimers.js +50 -31
  54. package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
  55. package/Libraries/Image/Image.android.js +23 -13
  56. package/Libraries/Image/Image.d.ts +14 -15
  57. package/Libraries/Image/Image.ios.js +21 -11
  58. package/Libraries/Image/Image.win32.js +5 -3
  59. package/Libraries/Image/ImageProps.js +16 -5
  60. package/Libraries/Image/ImageTypes.flow.js +7 -2
  61. package/Libraries/Image/ImageUtils.js +1 -0
  62. package/Libraries/Image/ImageViewNativeComponent.js +2 -1
  63. package/Libraries/Inspector/ElementBox.js +6 -3
  64. package/Libraries/Inspector/ElementProperties.js +1 -1
  65. package/Libraries/Interaction/TouchHistoryMath.js +4 -4
  66. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
  67. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  68. package/Libraries/LogBox/Data/LogBoxData.js +39 -29
  69. package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
  70. package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
  71. package/Libraries/LogBox/LogBox.js +29 -12
  72. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  73. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  74. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  75. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  76. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  77. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
  78. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
  79. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  80. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
  81. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
  82. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  83. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  84. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  85. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  86. package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
  87. package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
  88. package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
  89. package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
  90. package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
  91. package/Libraries/Network/XMLHttpRequest.js +5 -1
  92. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  93. package/Libraries/Pressability/Pressability.js +3 -51
  94. package/Libraries/Pressability/Pressability.win32.js +3 -51
  95. package/Libraries/ReactNative/AppContainer-dev.js +3 -2
  96. package/Libraries/ReactNative/AppContainer-prod.js +2 -1
  97. package/Libraries/ReactNative/AppContainer.js +2 -0
  98. package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
  99. package/Libraries/ReactNative/AppRegistry.js +10 -4
  100. package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
  101. package/Libraries/ReactNative/FabricUIManager.js +0 -51
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
  103. package/Libraries/ReactNative/RendererImplementation.js +20 -2
  104. package/Libraries/ReactNative/UIManager.d.ts +0 -21
  105. package/Libraries/ReactNative/UIManagerProperties.js +0 -3
  106. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
  107. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
  108. package/Libraries/ReactNative/renderApplication.js +3 -0
  109. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
  110. package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
  111. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
  114. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
  115. package/Libraries/Renderer/shims/ReactFabric.js +2 -2
  116. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  117. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  118. package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
  119. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
  120. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  121. package/Libraries/Share/Share.d.ts +16 -10
  122. package/Libraries/Share/Share.js +14 -15
  123. package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
  124. package/Libraries/StyleSheet/StyleSheet.js +3 -10
  125. package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
  126. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
  127. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
  128. package/Libraries/StyleSheet/flattenStyle.js +1 -0
  129. package/Libraries/StyleSheet/processFilter.js +132 -0
  130. package/Libraries/StyleSheet/processTransform.js +18 -3
  131. package/Libraries/Text/Text.js +151 -128
  132. package/Libraries/Text/Text.win32.js +163 -138
  133. package/Libraries/Text/TextNativeComponent.js +5 -4
  134. package/Libraries/Text/TextNativeComponent.win32.js +5 -4
  135. package/Libraries/Text/TextProps.js +6 -6
  136. package/Libraries/Text/TextProps.win32.js +6 -6
  137. package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
  138. package/Libraries/Types/CodegenTypes.js +3 -0
  139. package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
  140. package/Libraries/Utilities/Dimensions.js +1 -0
  141. package/Libraries/Utilities/Dimensions.win32.js +1 -0
  142. package/Libraries/Utilities/HMRClient.js +36 -8
  143. package/Libraries/Utilities/HMRClientProdShim.js +1 -0
  144. package/Libraries/Utilities/Platform.android.js +4 -4
  145. package/Libraries/Utilities/RCTLog.js +1 -0
  146. package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
  147. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
  148. package/Libraries/__tests__/ButtonWin32-test.js +7 -6
  149. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  150. package/jest/mockComponent.js +7 -0
  151. package/jest/renderer.js +25 -14
  152. package/jest/setup.js +19 -13
  153. package/jest.config.js +2 -1
  154. package/overrides.json +30 -29
  155. package/package.json +27 -25
  156. package/rn-get-polyfills.js +1 -0
  157. package/src/private/core/composeStyles.js +27 -0
  158. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
  159. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  160. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
  161. package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
  162. package/src/private/specs/modules/NativeBlobModule.js +4 -2
  163. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  164. package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
  165. package/src/private/specs/modules/NativeUIManager.js +0 -7
  166. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
  167. package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
  168. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
  169. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
  170. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
  171. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
  172. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
  173. package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
  174. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
  175. package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
  176. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
  177. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
  178. package/src/private/webapis/performance/EventCounts.js +1 -1
  179. package/src/private/webapis/performance/MemoryInfo.js +9 -9
  180. package/src/private/webapis/performance/Performance.js +10 -56
  181. package/src/private/webapis/performance/PerformanceObserver.js +30 -22
  182. package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
  183. package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
  184. package/src/private/webapis/performance/UserTiming.js +63 -0
  185. package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
  186. package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
  187. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
  188. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
  189. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  190. package/types/modules/globals.d.ts +4 -0
  191. package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
  192. package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
  193. package/Libraries/Utilities/LoadingView.ios.js +0 -50
  194. package/Libraries/Utilities/LoadingView.js +0 -16
  195. package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
  196. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
  197. package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
  198. package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
  199. package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
  200. package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
  201. package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
  202. package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
  203. package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
  204. package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
  205. package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
  206. package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
@@ -56,8 +56,10 @@ const Text: React.AbstractComponent<
56
56
  'aria-selected': ariaSelected,
57
57
  'aria-setsize': ariaSetsize, // Win32
58
58
  ellipsizeMode,
59
+ disabled,
59
60
  id,
60
61
  nativeID,
62
+ numberOfLines,
61
63
  onLongPress,
62
64
  onPress,
63
65
  onPressIn,
@@ -69,15 +71,20 @@ const Text: React.AbstractComponent<
69
71
  onResponderTerminationRequest,
70
72
  onStartShouldSetResponder,
71
73
  pressRetentionOffset,
74
+ selectable,
75
+ selectionColor,
72
76
  suppressHighlighting,
77
+ style,
73
78
  ...restProps
74
79
  } = props;
75
80
 
76
81
  const [isHighlighted, setHighlighted] = useState(false);
77
82
 
78
- let _accessibilityState;
83
+ const _accessibilityLabel = ariaLabel ?? accessibilityLabel;
84
+
85
+ let _accessibilityState: ?TextProps['accessibilityState'] =
86
+ accessibilityState;
79
87
  if (
80
- accessibilityState != null ||
81
88
  ariaBusy != null ||
82
89
  ariaChecked != null ||
83
90
  ariaDisabled != null ||
@@ -86,27 +93,32 @@ const Text: React.AbstractComponent<
86
93
  ariaRequired != null ||
87
94
  ariaSelected != null
88
95
  ) {
89
- _accessibilityState = {
90
- busy: ariaBusy ?? accessibilityState?.busy,
91
- checked: ariaChecked ?? accessibilityState?.checked,
92
- disabled: ariaDisabled ?? accessibilityState?.disabled,
93
- expanded: ariaExpanded ?? accessibilityState?.expanded,
94
- multiselectable:
95
- ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
96
- required: ariaRequired ?? accessibilityState?.required, // Win32
97
- selected: ariaSelected ?? accessibilityState?.selected,
98
- };
96
+ if (_accessibilityState != null) {
97
+ _accessibilityState = {
98
+ busy: ariaBusy ?? _accessibilityState.busy,
99
+ checked: ariaChecked ?? _accessibilityState.checked,
100
+ disabled: ariaDisabled ?? _accessibilityState.disabled,
101
+ expanded: ariaExpanded ?? _accessibilityState.expanded,
102
+ multiselectable:
103
+ ariaMultiselectable ?? accessibilityState?.multiselectable, // Win32
104
+ required: ariaRequired ?? accessibilityState?.required, // Win32
105
+ selected: ariaSelected ?? _accessibilityState.selected,
106
+ };
107
+ } else {
108
+ _accessibilityState = {
109
+ busy: ariaBusy,
110
+ checked: ariaChecked,
111
+ disabled: ariaDisabled,
112
+ expanded: ariaExpanded,
113
+ multiselectable: ariaMultiselectable, // Win32,
114
+ required: ariaRequired, // Win32
115
+ selected: ariaSelected,
116
+ };
117
+ }
99
118
  }
100
119
 
101
- const _disabled =
102
- restProps.disabled != null
103
- ? restProps.disabled
104
- : _accessibilityState?.disabled;
105
-
106
- const nativeTextAccessibilityState =
107
- _disabled !== _accessibilityState?.disabled
108
- ? {..._accessibilityState, disabled: _disabled}
109
- : _accessibilityState;
120
+ const _accessibilityStateDisabled = _accessibilityState?.disabled;
121
+ const _disabled = disabled ?? _accessibilityStateDisabled;
110
122
 
111
123
  const isPressable =
112
124
  (onPress != null ||
@@ -115,46 +127,47 @@ const Text: React.AbstractComponent<
115
127
  _disabled !== true;
116
128
 
117
129
  const initialized = useLazyInitialization(isPressable);
118
- const config = useMemo(
119
- () =>
120
- initialized
121
- ? {
122
- disabled: !isPressable,
123
- pressRectOffset: pressRetentionOffset,
124
- onLongPress,
125
- onPress,
126
- onPressIn(event: PressEvent) {
127
- // Updating isHighlighted causes unnecessary re-renders for platforms that don't use it
128
- // in the best case, and cause issues with text selection in the worst case. Forcing
129
- // the isHighlighted prop to false on all platforms except iOS.
130
- setHighlighted(
131
- (suppressHighlighting == null || !suppressHighlighting) &&
132
- Platform.OS === 'ios',
133
- );
134
- onPressIn?.(event);
135
- },
136
- onPressOut(event: PressEvent) {
137
- setHighlighted(false);
138
- onPressOut?.(event);
139
- },
140
- onResponderTerminationRequest_DEPRECATED:
141
- onResponderTerminationRequest,
142
- onStartShouldSetResponder_DEPRECATED: onStartShouldSetResponder,
143
- }
144
- : null,
145
- [
146
- initialized,
147
- isPressable,
148
- pressRetentionOffset,
130
+ const config = useMemo(() => {
131
+ if (!initialized) {
132
+ return null;
133
+ }
134
+
135
+ let _onPressIn = onPressIn;
136
+ let _onPressOut = onPressOut;
137
+
138
+ // Updating isHighlighted causes unnecessary re-renders for platforms that don't use it
139
+ // in the best case, and cause issues with text selection in the worst case. Forcing
140
+ // the isHighlighted prop to false on all platforms except iOS.
141
+ if (Platform.OS === 'ios') {
142
+ _onPressIn = (event: PressEvent) => {
143
+ setHighlighted(suppressHighlighting == null || !suppressHighlighting);
144
+ onPressIn?.(event);
145
+ };
146
+
147
+ _onPressOut = (event: PressEvent) => {
148
+ setHighlighted(false);
149
+ onPressOut?.(event);
150
+ };
151
+ }
152
+
153
+ return {
154
+ disabled: !isPressable,
155
+ pressRectOffset: pressRetentionOffset,
149
156
  onLongPress,
150
157
  onPress,
151
- onPressIn,
152
- onPressOut,
153
- onResponderTerminationRequest,
154
- onStartShouldSetResponder,
155
- suppressHighlighting,
156
- ],
157
- );
158
+ onPressIn: _onPressIn,
159
+ onPressOut: _onPressOut,
160
+ };
161
+ }, [
162
+ initialized,
163
+ isPressable,
164
+ pressRetentionOffset,
165
+ onLongPress,
166
+ onPress,
167
+ onPressIn,
168
+ onPressOut,
169
+ suppressHighlighting,
170
+ ]);
158
171
 
159
172
  const eventHandlers = usePressability(config);
160
173
  const eventHandlersForText = useMemo(
@@ -188,8 +201,13 @@ const Text: React.AbstractComponent<
188
201
  },
189
202
  onClick: eventHandlers.onClick,
190
203
  onResponderTerminationRequest:
191
- eventHandlers.onResponderTerminationRequest,
192
- onStartShouldSetResponder: eventHandlers.onStartShouldSetResponder,
204
+ onResponderTerminationRequest != null
205
+ ? onResponderTerminationRequest
206
+ : eventHandlers.onResponderTerminationRequest,
207
+ onStartShouldSetResponder:
208
+ onStartShouldSetResponder != null
209
+ ? onStartShouldSetResponder
210
+ : eventHandlers.onStartShouldSetResponder,
193
211
  },
194
212
  [
195
213
  eventHandlers,
@@ -197,119 +215,126 @@ const Text: React.AbstractComponent<
197
215
  onResponderMove,
198
216
  onResponderRelease,
199
217
  onResponderTerminate,
218
+ onResponderTerminationRequest,
219
+ onStartShouldSetResponder,
200
220
  ],
201
221
  );
202
222
 
203
223
  // TODO: Move this processing to the view configuration.
204
- const selectionColor =
205
- restProps.selectionColor == null
206
- ? null
207
- : processColor(restProps.selectionColor);
208
-
209
- let style = restProps.style;
224
+ const _selectionColor =
225
+ selectionColor == null ? null : processColor(selectionColor);
210
226
 
227
+ let _style = style;
211
228
  if (__DEV__) {
212
229
  if (PressabilityDebug.isEnabled() && onPress != null) {
213
- style = [restProps.style, {color: 'magenta'}];
230
+ _style = [style, {color: 'magenta'}];
214
231
  }
215
232
  }
216
233
 
217
- let numberOfLines = restProps.numberOfLines;
218
- if (numberOfLines != null && !(numberOfLines >= 0)) {
219
- console.error(
220
- `'numberOfLines' in <Text> must be a non-negative number, received: ${numberOfLines}. The value will be set to 0.`,
221
- );
222
- numberOfLines = 0;
234
+ let _numberOfLines = numberOfLines;
235
+ if (_numberOfLines != null && !(_numberOfLines >= 0)) {
236
+ if (__DEV__) {
237
+ console.error(
238
+ `'numberOfLines' in <Text> must be a non-negative number, received: ${_numberOfLines}. The value will be set to 0.`,
239
+ );
240
+ }
241
+ _numberOfLines = 0;
223
242
  }
224
243
 
225
- const hasTextAncestor = useContext(TextAncestor);
226
-
227
- const _accessible = Platform.select({
228
- ios: accessible !== false,
229
- default: accessible,
230
- });
244
+ let _selectable = selectable;
245
+ const processedStyle = flattenStyle(_style);
246
+ if (processedStyle != null) {
247
+ if (typeof processedStyle.fontWeight === 'number') {
248
+ // $FlowFixMe[cannot-write]
249
+ processedStyle.fontWeight = processedStyle.fontWeight.toString();
250
+ }
231
251
 
232
- // $FlowFixMe[underconstrained-implicit-instantiation]
233
- style = flattenStyle(style);
252
+ if (processedStyle.userSelect != null) {
253
+ _selectable = userSelectToSelectableMap[processedStyle.userSelect];
254
+ // $FlowFixMe[cannot-write]
255
+ delete processedStyle.userSelect;
256
+ }
234
257
 
235
- if (typeof style?.fontWeight === 'number') {
236
- // $FlowFixMe[prop-missing]
237
- // $FlowFixMe[cannot-write]
238
- style.fontWeight = style?.fontWeight.toString();
258
+ if (processedStyle.verticalAlign != null) {
259
+ // $FlowFixMe[cannot-write]
260
+ processedStyle.textAlignVertical =
261
+ verticalAlignToTextAlignVerticalMap[processedStyle.verticalAlign];
262
+ // $FlowFixMe[cannot-write]
263
+ delete processedStyle.verticalAlign;
264
+ }
239
265
  }
240
266
 
241
- let _selectable = restProps.selectable;
242
- if (style?.userSelect != null) {
243
- // $FlowFixMe[invalid-computed-prop]
244
- _selectable = userSelectToSelectableMap[style.userSelect];
245
- // $FlowFixMe[prop-missing]
246
- // $FlowFixMe[cannot-write]
247
- delete style.userSelect;
267
+ const _nativeID = id ?? nativeID;
268
+
269
+ const hasTextAncestor = useContext(TextAncestor);
270
+ if (hasTextAncestor) {
271
+ return (
272
+ <NativeVirtualText
273
+ {...restProps}
274
+ {...eventHandlersForText}
275
+ accessibilityLabel={_accessibilityLabel}
276
+ accessibilityState={_accessibilityState}
277
+ accessibilityControls={ariaControls ?? accessibilityControls} // Win32
278
+ accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
279
+ accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
280
+ accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
281
+ accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
282
+ accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
283
+ isHighlighted={isHighlighted}
284
+ isPressable={isPressable}
285
+ nativeID={_nativeID}
286
+ numberOfLines={_numberOfLines}
287
+ ref={forwardedRef}
288
+ selectable={_selectable}
289
+ selectionColor={_selectionColor}
290
+ style={processedStyle}
291
+ disabled={disabled}
292
+ />
293
+ );
248
294
  }
249
295
 
250
- if (style?.verticalAlign != null) {
251
- // $FlowFixMe[prop-missing]
252
- // $FlowFixMe[cannot-write]
253
- style.textAlignVertical =
254
- // $FlowFixMe[invalid-computed-prop]
255
- verticalAlignToTextAlignVerticalMap[style.verticalAlign];
256
- // $FlowFixMe[prop-missing]
257
- // $FlowFixMe[cannot-write]
258
- delete style.verticalAlign;
296
+ // If the disabled prop and accessibilityState.disabled are out of sync but not both in
297
+ // falsy states we need to update the accessibilityState object to use the disabled prop.
298
+ if (
299
+ _disabled !== _accessibilityStateDisabled &&
300
+ ((_disabled != null && _disabled !== false) ||
301
+ (_accessibilityStateDisabled != null &&
302
+ _accessibilityStateDisabled !== false))
303
+ ) {
304
+ _accessibilityState = {..._accessibilityState, disabled: _disabled};
259
305
  }
260
306
 
261
- const _hasOnPressOrOnLongPress =
262
- props.onPress != null || props.onLongPress != null;
307
+ const _accessible = Platform.select({
308
+ ios: accessible !== false,
309
+ android:
310
+ accessible == null ? onPress != null || onLongPress != null : accessible,
311
+ default: accessible !== false,
312
+ });
263
313
 
264
- return hasTextAncestor ? (
265
- <NativeVirtualText
266
- {...restProps}
267
- {...eventHandlersForText}
268
- accessibilityControls={ariaControls ?? accessibilityControls} // Win32
269
- accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
270
- accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
271
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
272
- accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
273
- accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
274
- accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
275
- accessibilityState={_accessibilityState}
276
- isHighlighted={isHighlighted}
277
- isPressable={isPressable}
278
- nativeID={id ?? nativeID}
279
- numberOfLines={numberOfLines}
280
- ref={forwardedRef}
281
- selectable={_selectable}
282
- selectionColor={selectionColor}
283
- style={style}
284
- />
285
- ) : (
314
+ return (
286
315
  <TextAncestor.Provider value={true}>
287
316
  <NativeText
288
317
  {...restProps}
289
318
  {...eventHandlersForText}
319
+ accessibilityLabel={_accessibilityLabel}
320
+ accessibilityState={_accessibilityState}
321
+ accessible={_accessible}
290
322
  accessibilityControls={ariaControls ?? accessibilityControls} // Win32
291
323
  accessibilityDescribedBy={ariaDescribedBy ?? accessibilityDescribedBy} // Win32
292
324
  accessibilityDescription={ariaDescription ?? accessibilityDescription} // Win32
293
- accessibilityLabel={ariaLabel ?? accessibilityLabel}
294
325
  accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
295
326
  accessibilityPositionInSet={ariaPosinset ?? accessibilityPositionInSet} // Win32
296
327
  accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
297
- accessibilityState={nativeTextAccessibilityState}
298
- accessible={
299
- accessible == null && Platform.OS === 'android'
300
- ? _hasOnPressOrOnLongPress
301
- : _accessible
302
- }
303
328
  allowFontScaling={allowFontScaling !== false}
304
329
  disabled={_disabled}
305
330
  ellipsizeMode={ellipsizeMode ?? 'tail'}
306
331
  isHighlighted={isHighlighted}
307
- nativeID={id ?? nativeID}
308
- numberOfLines={numberOfLines}
332
+ nativeID={_nativeID}
333
+ numberOfLines={_numberOfLines}
309
334
  ref={forwardedRef}
310
335
  selectable={_selectable}
311
- selectionColor={selectionColor}
312
- style={style}
336
+ selectionColor={_selectionColor}
337
+ style={processedStyle}
313
338
  />
314
339
  </TextAncestor.Provider>
315
340
  );
@@ -345,4 +370,4 @@ const verticalAlignToTextAlignVerticalMap = {
345
370
  middle: 'center',
346
371
  };
347
372
 
348
- module.exports = Text;
373
+ module.exports = Text;
@@ -8,13 +8,14 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
12
+ import type {ProcessedColorValue} from '../StyleSheet/processColor';
13
+ import type {PressEvent} from '../Types/CoreEventTypes';
14
+ import type {TextProps} from './TextProps';
15
+
11
16
  import {createViewConfig} from '../NativeComponent/ViewConfig';
12
17
  import UIManager from '../ReactNative/UIManager';
13
18
  import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
14
- import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
15
- import {type ProcessedColorValue} from '../StyleSheet/processColor';
16
- import {type PressEvent} from '../Types/CoreEventTypes';
17
- import {type TextProps} from './TextProps';
18
19
 
19
20
  type NativeTextProps = $ReadOnly<{
20
21
  ...TextProps,
@@ -8,13 +8,14 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
12
+ import type {ProcessedColorValue} from '../StyleSheet/processColor';
13
+ import type {PressEvent} from '../Types/CoreEventTypes';
14
+ import type {TextProps} from './TextProps';
15
+
11
16
  import {createViewConfig} from '../NativeComponent/ViewConfig';
12
17
  import UIManager from '../ReactNative/UIManager';
13
18
  import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
14
- import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
15
- import {type ProcessedColorValue} from '../StyleSheet/processColor';
16
- import {type PressEvent} from '../Types/CoreEventTypes';
17
- import {type TextProps} from './TextProps';
18
19
 
19
20
  type NativeTextProps = $ReadOnly<{
20
21
  ...TextProps,
@@ -26,23 +26,23 @@ import type {
26
26
  } from '../Types/CoreEventTypes';
27
27
  import type {Node} from 'react';
28
28
 
29
- export type PressRetentionOffset = $ReadOnly<{|
29
+ export type PressRetentionOffset = $ReadOnly<{
30
30
  top: number,
31
31
  left: number,
32
32
  bottom: number,
33
33
  right: number,
34
- |}>;
34
+ }>;
35
35
 
36
- type PointerEventProps = $ReadOnly<{|
36
+ type PointerEventProps = $ReadOnly<{
37
37
  onPointerEnter?: (event: PointerEvent) => void,
38
38
  onPointerLeave?: (event: PointerEvent) => void,
39
39
  onPointerMove?: (event: PointerEvent) => void,
40
- |}>;
40
+ }>;
41
41
 
42
42
  /**
43
43
  * @see https://reactnative.dev/docs/text#reference
44
44
  */
45
- export type TextProps = $ReadOnly<{|
45
+ export type TextProps = $ReadOnly<{
46
46
  ...PointerEventProps,
47
47
 
48
48
  /**
@@ -265,4 +265,4 @@ export type TextProps = $ReadOnly<{|
265
265
  * See https://reactnative.dev/docs/text.html#linebreakstrategyios
266
266
  */
267
267
  lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
268
- |}>;
268
+ }>;
@@ -26,23 +26,23 @@ import type {
26
26
  } from '../Types/CoreEventTypes';
27
27
  import type {Node} from 'react';
28
28
 
29
- export type PressRetentionOffset = $ReadOnly<{|
29
+ export type PressRetentionOffset = $ReadOnly<{
30
30
  top: number,
31
31
  left: number,
32
32
  bottom: number,
33
33
  right: number,
34
- |}>;
34
+ }>;
35
35
 
36
- type PointerEventProps = $ReadOnly<{|
36
+ type PointerEventProps = $ReadOnly<{
37
37
  onPointerEnter?: (event: PointerEvent) => void,
38
38
  onPointerLeave?: (event: PointerEvent) => void,
39
39
  onPointerMove?: (event: PointerEvent) => void,
40
- |}>;
40
+ }>;
41
41
 
42
42
  /**
43
43
  * @see https://reactnative.dev/docs/text#reference
44
44
  */
45
- export type TextProps = $ReadOnly<{|
45
+ export type TextProps = $ReadOnly<{
46
46
  ...PointerEventProps,
47
47
 
48
48
  /**
@@ -278,4 +278,4 @@ export type TextProps = $ReadOnly<{|
278
278
  * See https://reactnative.dev/docs/text.html#linebreakstrategyios
279
279
  */
280
280
  lineBreakStrategyIOS?: ?('none' | 'standard' | 'hangul-word' | 'push-out'),
281
- |}>;
281
+ }>;
@@ -76,7 +76,8 @@ export function getEnforcing<T: TurboModule>(name: string): T {
76
76
  'Verify that a module by this name is registered in the native binary.';
77
77
 
78
78
  if (shouldReportDebugInfo()) {
79
- message += 'Bridgeless mode: ' + (isBridgeless() ? 'true' : 'false') + '. ';
79
+ message +=
80
+ ' Bridgeless mode: ' + (isBridgeless() ? 'true' : 'false') + '. ';
80
81
  message +=
81
82
  'TurboModule interop: ' +
82
83
  (isTurboModuleInteropEnabled() ? 'true' : 'false') +
@@ -10,6 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import type {EventSubscription} from '../vendor/emitter/EventEmitter';
13
14
  import type {SyntheticEvent} from './CoreEventTypes';
14
15
 
15
16
  // Event types
@@ -40,3 +41,5 @@ type DefaultTypes = number | boolean | string | $ReadOnlyArray<string>;
40
41
  //
41
42
  // eslint-disable-next-line no-unused-vars
42
43
  export type WithDefault<Type: DefaultTypes, Value: ?Type | string> = ?Type;
44
+
45
+ export type EventEmitter<T> = (handler: (T) => mixed) => EventSubscription;
@@ -12,23 +12,45 @@ import processColor from '../StyleSheet/processColor';
12
12
  import Appearance from './Appearance';
13
13
  import NativeDevLoadingView from './NativeDevLoadingView';
14
14
 
15
+ const COLOR_SCHEME = {
16
+ dark: {
17
+ refresh: {
18
+ backgroundColor: '#2584e8',
19
+ textColor: '#ffffff',
20
+ },
21
+ load: {
22
+ backgroundColor: '#fafafa',
23
+ textColor: '#242526',
24
+ },
25
+ },
26
+ default: {
27
+ refresh: {
28
+ backgroundColor: '#2584e8',
29
+ textColor: '#ffffff',
30
+ },
31
+ load: {
32
+ backgroundColor: '#404040',
33
+ textColor: '#ffffff',
34
+ },
35
+ },
36
+ };
37
+
15
38
  module.exports = {
16
39
  showMessage(message: string, type: 'load' | 'refresh') {
17
40
  if (NativeDevLoadingView) {
41
+ const colorScheme =
42
+ Appearance.getColorScheme() === 'dark'
43
+ ? COLOR_SCHEME.dark
44
+ : COLOR_SCHEME.default;
45
+
46
+ const colorSet = colorScheme[type];
47
+
18
48
  let backgroundColor;
19
49
  let textColor;
20
50
 
21
- if (type === 'refresh') {
22
- backgroundColor = processColor('#2584e8');
23
- textColor = processColor('#ffffff');
24
- } else if (type === 'load') {
25
- if (Appearance.getColorScheme() === 'dark') {
26
- backgroundColor = processColor('#fafafa');
27
- textColor = processColor('#242526');
28
- } else {
29
- backgroundColor = processColor('#404040');
30
- textColor = processColor('#ffffff');
31
- }
51
+ if (colorSet) {
52
+ backgroundColor = processColor(colorSet.backgroundColor);
53
+ textColor = processColor(colorSet.textColor);
32
54
  }
33
55
 
34
56
  NativeDevLoadingView.showMessage(
@@ -44,6 +44,7 @@ class Dimensions {
44
44
  * @returns {DisplayMetrics? | DisplayMetricsAndroid?} Value for the dimension.
45
45
  */
46
46
  static get(dim: string): DisplayMetrics | DisplayMetricsAndroid {
47
+ // $FlowFixMe[invalid-computed-prop]
47
48
  invariant(dimensions[dim], 'No dimension set for key ' + dim);
48
49
  return dimensions[dim];
49
50
  }
@@ -48,6 +48,7 @@ class Dimensions {
48
48
  * @returns {DisplayMetrics? | DisplayMetricsAndroid?} Value for the dimension.
49
49
  */
50
50
  static get(dim: string): DisplayMetrics | DisplayMetricsAndroid {
51
+ // $FlowFixMe[invalid-computed-prop]
51
52
  invariant(dimensions[dim], 'No dimension set for key ' + dim);
52
53
  return dimensions[dim];
53
54
  }