@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
@@ -784,33 +784,12 @@ export type Props = $ReadOnly<{|
784
784
  */
785
785
  onChange?: ?(e: ChangeEvent) => mixed,
786
786
 
787
- /**
788
- * DANGER: this API is not stable and will change in the future.
789
- *
790
- * Callback will be called on the main thread and may result in dropped frames.
791
- * Callback that is called when the text input's text changes.
792
- *
793
- * @platform ios
794
- */
795
- unstable_onChangeSync?: ?(e: ChangeEvent) => mixed,
796
-
797
787
  /**
798
788
  * Callback that is called when the text input's text changes.
799
789
  * Changed text is passed as an argument to the callback handler.
800
790
  */
801
791
  onChangeText?: ?(text: string) => mixed,
802
792
 
803
- /**
804
- * DANGER: this API is not stable and will change in the future.
805
- *
806
- * Callback will be called on the main thread and may result in dropped frames.
807
- * Callback that is called when the text input's text changes.
808
- * Changed text is passed as an argument to the callback handler.
809
- *
810
- * @platform ios
811
- */
812
- unstable_onChangeTextSync?: ?(text: string) => mixed,
813
-
814
793
  /**
815
794
  * Callback that is called when the text input's content size changes.
816
795
  * This will be called with
@@ -839,21 +818,6 @@ export type Props = $ReadOnly<{|
839
818
  */
840
819
  onKeyPress?: ?(e: KeyPressEvent) => mixed,
841
820
 
842
- /**
843
- * DANGER: this API is not stable and will change in the future.
844
- *
845
- * Callback will be called on the main thread and may result in dropped frames.
846
- *
847
- * Callback that is called when a key is pressed.
848
- * This will be called with `{ nativeEvent: { key: keyValue } }`
849
- * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and
850
- * the typed-in character otherwise including `' '` for space.
851
- * Fires before `onChange` callbacks.
852
- *
853
- * @platform ios
854
- */
855
- unstable_onKeyPressSync?: ?(e: KeyPressEvent) => mixed,
856
-
857
821
  /**
858
822
  * Called when a single tap gesture is detected.
859
823
  */
@@ -1180,12 +1144,14 @@ function InternalTextInput(props: Props): React.Node {
1180
1144
  };
1181
1145
 
1182
1146
  const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
1183
-
1184
1147
  const [lastNativeText, setLastNativeText] = useState<?Stringish>(props.value);
1185
1148
  const [lastNativeSelectionState, setLastNativeSelection] = useState<{|
1186
- selection: ?Selection,
1149
+ selection: Selection,
1187
1150
  mostRecentEventCount: number,
1188
- |}>({selection, mostRecentEventCount});
1151
+ |}>({
1152
+ selection: {start: -1, end: -1},
1153
+ mostRecentEventCount: mostRecentEventCount,
1154
+ });
1189
1155
 
1190
1156
  const lastNativeSelection = lastNativeSelectionState.selection;
1191
1157
 
@@ -1315,12 +1281,8 @@ function InternalTextInput(props: Props): React.Node {
1315
1281
  }
1316
1282
  },
1317
1283
  isFocused(): boolean {
1318
- const currentlyFocusedInput =
1319
- TextInputState.currentlyFocusedInput();
1320
- return (
1321
- currentlyFocusedInput !== null &&
1322
- currentlyFocusedInput === inputRef.current
1323
- );
1284
+ const currentlyFocusedInput = TextInputState.currentlyFocusedInput();
1285
+ return currentlyFocusedInput !== null && currentlyFocusedInput === inputRef.current;
1324
1286
  },
1325
1287
  getNativeRef(): ?React.ElementRef<HostComponent<mixed>> {
1326
1288
  return inputRef.current;
@@ -1363,26 +1325,6 @@ function InternalTextInput(props: Props): React.Node {
1363
1325
  setMostRecentEventCount(event.nativeEvent.eventCount);
1364
1326
  };
1365
1327
 
1366
- const _onChangeSync = (event: ChangeEvent) => {
1367
- const currentText = event.nativeEvent.text;
1368
- props.unstable_onChangeSync && props.unstable_onChangeSync(event);
1369
- props.unstable_onChangeTextSync &&
1370
- props.unstable_onChangeTextSync(currentText);
1371
-
1372
- if (inputRef.current == null) {
1373
- // calling `props.onChange` or `props.onChangeText`
1374
- // may clean up the input itself. Exits here.
1375
- return;
1376
- }
1377
-
1378
- setLastNativeText(currentText);
1379
- // This must happen last, after we call setLastNativeText.
1380
- // Different ordering can cause bugs when editing AndroidTextInputs
1381
- // with multiple Fragments.
1382
- // We must update this so that controlled input updates work.
1383
- setMostRecentEventCount(event.nativeEvent.eventCount);
1384
- };
1385
-
1386
1328
  const _onSelectionChange = (event: SelectionChangeEvent) => {
1387
1329
  props.onSelectionChange && props.onSelectionChange(event);
1388
1330
 
@@ -1574,6 +1516,12 @@ function InternalTextInput(props: Props): React.Node {
1574
1516
 
1575
1517
  const style = flattenStyle<TextStyleProp>(props.style);
1576
1518
 
1519
+ if (typeof style?.fontWeight === 'number') {
1520
+ // $FlowFixMe[prop-missing]
1521
+ // $FlowFixMe[cannot-write]
1522
+ style.fontWeight = style?.fontWeight.toString();
1523
+ }
1524
+
1577
1525
  if (Platform.OS === 'ios') {
1578
1526
  const RCTTextInputView =
1579
1527
  props.multiline === true
@@ -1587,10 +1535,6 @@ function InternalTextInput(props: Props): React.Node {
1587
1535
  style.paddingVertical == null &&
1588
1536
  style.paddingTop == null));
1589
1537
 
1590
- const useOnChangeSync =
1591
- (props.unstable_onChangeSync || props.unstable_onChangeTextSync) &&
1592
- !(props.onChange || props.onChangeText);
1593
-
1594
1538
  textInput = (
1595
1539
  <RCTTextInputView
1596
1540
  // $FlowFixMe[incompatible-type] - Figure out imperative + forward refs.
@@ -1607,15 +1551,14 @@ function InternalTextInput(props: Props): React.Node {
1607
1551
  mostRecentEventCount={mostRecentEventCount}
1608
1552
  nativeID={id ?? props.nativeID}
1609
1553
  onBlur={_onBlur}
1610
- onKeyPressSync={props.unstable_onKeyPressSync}
1611
1554
  onChange={_onChange}
1612
- onChangeSync={useOnChangeSync === true ? _onChangeSync : null}
1613
1555
  onContentSizeChange={props.onContentSizeChange}
1614
1556
  onFocus={_onFocus}
1615
1557
  onScroll={_onScroll}
1616
1558
  onSelectionChange={_onSelectionChange}
1617
1559
  onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
1618
1560
  selection={selection}
1561
+ selectionColor={selectionColor}
1619
1562
  style={StyleSheet.compose(
1620
1563
  useMultilineDefaultStyle ? styles.multilineDefault : null,
1621
1564
  style,
@@ -1877,10 +1820,13 @@ const ExportedForwardRef: React.AbstractComponent<
1877
1820
  : undefined
1878
1821
  }
1879
1822
  textContentType={
1880
- Platform.OS === 'ios' &&
1881
- autoComplete &&
1882
- autoComplete in autoCompleteWebToTextContentTypeMap
1883
- ? // $FlowFixMe
1823
+ textContentType != null
1824
+ ? textContentType
1825
+ : Platform.OS === 'ios' &&
1826
+ autoComplete &&
1827
+ autoComplete in autoCompleteWebToTextContentTypeMap
1828
+ ? // $FlowFixMe[invalid-computed-prop]
1829
+ // $FlowFixMe[prop-missing]
1884
1830
  autoCompleteWebToTextContentTypeMap[autoComplete]
1885
1831
  : textContentType
1886
1832
  }
@@ -40,8 +40,8 @@ const extractSingleTouch = (nativeEvent: {
40
40
  return !hasTouches && hasChangedTouches
41
41
  ? changedTouches[0]
42
42
  : hasTouches
43
- ? touches[0]
44
- : nativeEvent;
43
+ ? touches[0]
44
+ : nativeEvent;
45
45
  };
46
46
 
47
47
  /**
@@ -8,12 +8,9 @@
8
8
  */
9
9
 
10
10
  import type * as React from 'react';
11
- import {Constructor} from '../../../types/private/Utilities';
12
- import {TimerMixin} from '../../../types/private/TimerMixin';
13
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
14
11
  import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
15
12
  import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
16
- import {TouchableMixin} from './Touchable';
13
+ import {View} from '../../Components/View/View';
17
14
  import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
18
15
 
19
16
  /**
@@ -60,9 +57,6 @@ export interface TouchableHighlightProps extends TouchableWithoutFeedbackProps {
60
57
  *
61
58
  * @see https://reactnative.dev/docs/touchablehighlight
62
59
  */
63
- declare class TouchableHighlightComponent extends React.Component<TouchableHighlightProps> {}
64
- declare const TouchableHighlightBase: Constructor<NativeMethods> &
65
- Constructor<TimerMixin> &
66
- Constructor<TouchableMixin> &
67
- typeof TouchableHighlightComponent;
68
- export class TouchableHighlight extends TouchableHighlightBase {}
60
+ export const TouchableHighlight: React.ForwardRefExoticComponent<
61
+ React.PropsWithoutRef<TouchableHighlightProps> & React.RefAttributes<View>
62
+ >;
@@ -342,7 +342,9 @@ class TouchableHighlight extends React.Component<Props, State> {
342
342
  nextFocusRight={this.props.nextFocusRight}
343
343
  nextFocusUp={this.props.nextFocusUp}
344
344
  focusable={
345
- this.props.focusable !== false && this.props.onPress !== undefined
345
+ this.props.focusable !== false &&
346
+ this.props.onPress !== undefined &&
347
+ !this.props.disabled
346
348
  }
347
349
  nativeID={this.props.id ?? this.props.nativeID}
348
350
  testID={this.props.testID}
@@ -8,11 +8,7 @@
8
8
  */
9
9
 
10
10
  import type * as React from 'react';
11
- import {Constructor} from '../../../types/private/Utilities';
12
- import {TimerMixin} from '../../../types/private/TimerMixin';
13
- import {NativeMethods} from '../../../types/public/ReactNativeTypes';
14
- import {TVParallaxProperties} from '../View/ViewPropTypes';
15
- import {TouchableMixin} from './Touchable';
11
+ import {View} from '../../Components/View/View';
16
12
  import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
17
13
 
18
14
  export interface TVProps {
@@ -70,22 +66,6 @@ export interface TouchableOpacityProps
70
66
  * Defaults to 0.2
71
67
  */
72
68
  activeOpacity?: number | undefined;
73
-
74
- /**
75
- * *(Apple TV only)* Object with properties to control Apple TV parallax effects.
76
- *
77
- * enabled: If true, parallax effects are enabled. Defaults to true.
78
- * shiftDistanceX: Defaults to 2.0.
79
- * shiftDistanceY: Defaults to 2.0.
80
- * tiltAngle: Defaults to 0.05.
81
- * magnification: Defaults to 1.0.
82
- * pressMagnification: Defaults to 1.0.
83
- * pressDuration: Defaults to 0.3.
84
- * pressDelay: Defaults to 0.0.
85
- *
86
- * @platform android
87
- */
88
- tvParallaxProperties?: TVParallaxProperties | undefined;
89
69
  }
90
70
 
91
71
  /**
@@ -96,14 +76,6 @@ export interface TouchableOpacityProps
96
76
  *
97
77
  * @see https://reactnative.dev/docs/touchableopacity
98
78
  */
99
- declare class TouchableOpacityComponent extends React.Component<TouchableOpacityProps> {}
100
- declare const TouchableOpacityBase: Constructor<TimerMixin> &
101
- Constructor<TouchableMixin> &
102
- Constructor<NativeMethods> &
103
- typeof TouchableOpacityComponent;
104
- export class TouchableOpacity extends TouchableOpacityBase {
105
- /**
106
- * Animate the touchable to a new opacity.
107
- */
108
- setOpacityTo: (value: number) => void;
109
- }
79
+ export const TouchableOpacity: React.ForwardRefExoticComponent<
80
+ React.PropsWithoutRef<TouchableOpacityProps> & React.RefAttributes<View>
81
+ >;
@@ -287,7 +287,9 @@ class TouchableOpacity extends React.Component<Props, State> {
287
287
  hasTVPreferredFocus={this.props.hasTVPreferredFocus}
288
288
  hitSlop={this.props.hitSlop}
289
289
  focusable={
290
- this.props.focusable !== false && this.props.onPress !== undefined
290
+ this.props.focusable !== false &&
291
+ this.props.onPress !== undefined &&
292
+ !this.props.disabled
291
293
  }
292
294
  ref={this.props.hostRef}
293
295
  {...eventHandlersWithoutBlurAndFocus}>
@@ -42,6 +42,8 @@ export interface TouchableWithoutFeedbackProps
42
42
  AccessibilityProps {
43
43
  children?: React.ReactNode | undefined;
44
44
 
45
+ rejectResponderTermination?: boolean | undefined;
46
+
45
47
  /**
46
48
  * Delay in ms, from onPressIn, before onLongPress is called.
47
49
  */
@@ -62,6 +64,12 @@ export interface TouchableWithoutFeedbackProps
62
64
  */
63
65
  disabled?: boolean | undefined;
64
66
 
67
+ /**
68
+ * Whether this View should be focusable with a non-touch input device,
69
+ * eg. receive focus with a hardware keyboard / TV remote.
70
+ */
71
+ focusable?: boolean | undefined;
72
+
65
73
  /**
66
74
  * This defines how far your touch can start away from the button.
67
75
  * This is added to pressRetentionOffset when moving off of the button.
@@ -24,11 +24,10 @@ import type {
24
24
  } from '../../Types/CoreEventTypes';
25
25
 
26
26
  import View from '../../Components/View/View';
27
- import Pressability, {
28
- type PressabilityConfig,
29
- } from '../../Pressability/Pressability';
30
27
  import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
28
+ import usePressability from '../../Pressability/usePressability';
31
29
  import * as React from 'react';
30
+ import {useMemo} from 'react';
32
31
 
33
32
  type Props = $ReadOnly<{|
34
33
  accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
@@ -85,10 +84,6 @@ type Props = $ReadOnly<{|
85
84
  touchSoundDisabled?: ?boolean,
86
85
  |}>;
87
86
 
88
- type State = $ReadOnly<{|
89
- pressability: Pressability,
90
- |}>;
91
-
92
87
  const PASSTHROUGH_PROPS = [
93
88
  'accessibilityActions',
94
89
  'accessibilityElementsHidden',
@@ -115,115 +110,126 @@ const PASSTHROUGH_PROPS = [
115
110
  'testID',
116
111
  ];
117
112
 
118
- class TouchableWithoutFeedback extends React.Component<Props, State> {
119
- state: State = {
120
- pressability: new Pressability(createPressabilityConfig(this.props)),
121
- };
122
-
123
- render(): React.Node {
124
- const element = React.Children.only<$FlowFixMe>(this.props.children);
125
- const children: Array<React.Node> = [element.props.children];
126
- const ariaLive = this.props['aria-live'];
127
-
128
- if (__DEV__) {
129
- if (element.type === View) {
130
- children.push(
131
- <PressabilityDebugView color="red" hitSlop={this.props.hitSlop} />,
132
- );
133
- }
134
- }
135
-
136
- let _accessibilityState = {
137
- busy: this.props['aria-busy'] ?? this.props.accessibilityState?.busy,
138
- checked:
139
- this.props['aria-checked'] ?? this.props.accessibilityState?.checked,
113
+ module.exports = function TouchableWithoutFeedback(props: Props): React.Node {
114
+ const {
115
+ disabled,
116
+ rejectResponderTermination,
117
+ 'aria-disabled': ariaDisabled,
118
+ accessibilityState,
119
+ hitSlop,
120
+ delayLongPress,
121
+ delayPressIn,
122
+ delayPressOut,
123
+ pressRetentionOffset,
124
+ touchSoundDisabled,
125
+ onBlur: _onBlur,
126
+ onFocus: _onFocus,
127
+ onLongPress,
128
+ onPress,
129
+ onPressIn,
130
+ onPressOut,
131
+ } = props;
132
+
133
+ const pressabilityConfig = useMemo(
134
+ () => ({
135
+ cancelable: !rejectResponderTermination,
140
136
  disabled:
141
- this.props['aria-disabled'] ?? this.props.accessibilityState?.disabled,
142
- expanded:
143
- this.props['aria-expanded'] ?? this.props.accessibilityState?.expanded,
144
- selected:
145
- this.props['aria-selected'] ?? this.props.accessibilityState?.selected,
146
- };
147
-
148
- // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before
149
- // adopting `Pressability`, so preserve that behavior.
150
- const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} =
151
- this.state.pressability.getEventHandlers();
152
-
153
- const elementProps: {[string]: mixed, ...} = {
154
- ...eventHandlersWithoutBlurAndFocus,
155
- accessible: this.props.accessible !== false,
156
- accessibilityState:
157
- this.props.disabled != null
158
- ? {
159
- ..._accessibilityState,
160
- disabled: this.props.disabled,
161
- }
162
- : _accessibilityState,
163
- focusable:
164
- this.props.focusable !== false && this.props.onPress !== undefined,
165
-
166
- accessibilityElementsHidden:
167
- this.props['aria-hidden'] ?? this.props.accessibilityElementsHidden,
168
- importantForAccessibility:
169
- this.props['aria-hidden'] === true
170
- ? 'no-hide-descendants'
171
- : this.props.importantForAccessibility,
172
- accessibilityLiveRegion:
173
- ariaLive === 'off'
174
- ? 'none'
175
- : ariaLive ?? this.props.accessibilityLiveRegion,
176
- nativeID: this.props.id ?? this.props.nativeID,
177
- };
178
- for (const prop of PASSTHROUGH_PROPS) {
179
- if (this.props[prop] !== undefined) {
180
- elementProps[prop] = this.props[prop];
181
- }
137
+ disabled !== null
138
+ ? disabled
139
+ : ariaDisabled ?? accessibilityState?.disabled,
140
+ hitSlop: hitSlop,
141
+ delayLongPress: delayLongPress,
142
+ delayPressIn: delayPressIn,
143
+ delayPressOut: delayPressOut,
144
+ minPressDuration: 0,
145
+ pressRectOffset: pressRetentionOffset,
146
+ android_disableSound: touchSoundDisabled,
147
+ onBlur: _onBlur,
148
+ onFocus: _onFocus,
149
+ onLongPress: onLongPress,
150
+ onPress: onPress,
151
+ onPressIn: onPressIn,
152
+ onPressOut: onPressOut,
153
+ }),
154
+ [
155
+ rejectResponderTermination,
156
+ disabled,
157
+ ariaDisabled,
158
+ accessibilityState?.disabled,
159
+ hitSlop,
160
+ delayLongPress,
161
+ delayPressIn,
162
+ delayPressOut,
163
+ pressRetentionOffset,
164
+ touchSoundDisabled,
165
+ _onBlur,
166
+ _onFocus,
167
+ onLongPress,
168
+ onPress,
169
+ onPressIn,
170
+ onPressOut,
171
+ ],
172
+ );
173
+
174
+ const eventHandlers = usePressability(pressabilityConfig);
175
+
176
+ const element = React.Children.only<$FlowFixMe>(props.children);
177
+ const children: Array<React.Node> = [element.props.children];
178
+ const ariaLive = props['aria-live'];
179
+
180
+ if (__DEV__) {
181
+ if (element.type === View) {
182
+ children.push(
183
+ <PressabilityDebugView color="red" hitSlop={props.hitSlop} />,
184
+ );
182
185
  }
183
-
184
- // $FlowFixMe[incompatible-call]
185
- return React.cloneElement(element, elementProps, ...children);
186
- }
187
-
188
- componentDidUpdate(): void {
189
- this.state.pressability.configure(createPressabilityConfig(this.props));
190
- }
191
-
192
- componentDidMount(): mixed {
193
- this.state.pressability.configure(createPressabilityConfig(this.props));
194
186
  }
195
187
 
196
- componentWillUnmount(): void {
197
- this.state.pressability.reset();
198
- }
199
- }
188
+ let _accessibilityState = {
189
+ busy: props['aria-busy'] ?? props.accessibilityState?.busy,
190
+ checked: props['aria-checked'] ?? props.accessibilityState?.checked,
191
+ disabled: props['aria-disabled'] ?? props.accessibilityState?.disabled,
192
+ expanded: props['aria-expanded'] ?? props.accessibilityState?.expanded,
193
+ selected: props['aria-selected'] ?? props.accessibilityState?.selected,
194
+ };
200
195
 
201
- function createPressabilityConfig({
202
- 'aria-disabled': ariaDisabled,
203
- ...props
204
- }: Props): PressabilityConfig {
205
- const accessibilityStateDisabled =
206
- ariaDisabled ?? props.accessibilityState?.disabled;
207
- return {
208
- cancelable: !props.rejectResponderTermination,
209
- disabled:
210
- props.disabled !== null ? props.disabled : accessibilityStateDisabled,
211
- hitSlop: props.hitSlop,
212
- delayLongPress: props.delayLongPress,
213
- delayPressIn: props.delayPressIn,
214
- delayPressOut: props.delayPressOut,
215
- minPressDuration: 0,
216
- pressRectOffset: props.pressRetentionOffset,
217
- android_disableSound: props.touchSoundDisabled,
218
- onBlur: props.onBlur,
219
- onFocus: props.onFocus,
220
- onLongPress: props.onLongPress,
221
- onPress: props.onPress,
222
- onPressIn: props.onPressIn,
223
- onPressOut: props.onPressOut,
196
+ // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before
197
+ // adopting `Pressability`, so preserve that behavior.
198
+ const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} =
199
+ eventHandlers || {};
200
+
201
+ const elementProps: {[string]: mixed, ...} = {
202
+ ...eventHandlersWithoutBlurAndFocus,
203
+ accessible: props.accessible !== false,
204
+ accessibilityState:
205
+ props.disabled != null
206
+ ? {
207
+ ..._accessibilityState,
208
+ disabled: props.disabled,
209
+ }
210
+ : _accessibilityState,
211
+ focusable:
212
+ props.focusable !== false &&
213
+ props.onPress !== undefined &&
214
+ !props.disabled,
215
+
216
+ accessibilityElementsHidden:
217
+ props['aria-hidden'] ?? props.accessibilityElementsHidden,
218
+ importantForAccessibility:
219
+ props['aria-hidden'] === true
220
+ ? 'no-hide-descendants'
221
+ : props.importantForAccessibility,
222
+ accessibilityLiveRegion:
223
+ ariaLive === 'off' ? 'none' : ariaLive ?? props.accessibilityLiveRegion,
224
+ nativeID: props.id ?? props.nativeID,
224
225
  };
225
- }
226
226
 
227
- TouchableWithoutFeedback.displayName = 'TouchableWithoutFeedback';
227
+ for (const prop of PASSTHROUGH_PROPS) {
228
+ if (props[prop] !== undefined) {
229
+ elementProps[prop] = props[prop];
230
+ }
231
+ }
228
232
 
229
- module.exports = TouchableWithoutFeedback;
233
+ // $FlowFixMe[incompatible-call]
234
+ return React.cloneElement(element, elementProps, ...children);
235
+ };
@@ -12,6 +12,7 @@ import type {AnyAttributeType} from '../../Renderer/shims/ReactNativeTypes';
12
12
 
13
13
  import processAspectRatio from '../../StyleSheet/processAspectRatio';
14
14
  import processColor from '../../StyleSheet/processColor';
15
+ import processFilter from '../../StyleSheet/processFilter';
15
16
  import processFontVariant from '../../StyleSheet/processFontVariant';
16
17
  import processTransform from '../../StyleSheet/processTransform';
17
18
  import processTransformOrigin from '../../StyleSheet/processTransformOrigin';
@@ -114,6 +115,11 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
114
115
  transform: {process: processTransform},
115
116
  transformOrigin: {process: processTransformOrigin},
116
117
 
118
+ /**
119
+ * Filter
120
+ */
121
+ experimental_filter: {process: processFilter},
122
+
117
123
  /**
118
124
  * View
119
125
  */
@@ -33,6 +33,7 @@ const UIView = {
33
33
  onMagicTap: true,
34
34
  onAccessibilityEscape: true,
35
35
  collapsable: true,
36
+ collapsableChildren: true,
36
37
  needsOffscreenAlphaCompositing: true,
37
38
  style: ReactNativeStyleAttributes,
38
39
  role: true,
@@ -33,6 +33,7 @@ const UIView = {
33
33
  onMagicTap: true,
34
34
  onAccessibilityEscape: true,
35
35
  collapsable: true,
36
+ collapsableChildren: true,
36
37
  needsOffscreenAlphaCompositing: true,
37
38
  style: ReactNativeStyleAttributes,
38
39
  role: true,
@@ -10,7 +10,6 @@
10
10
 
11
11
  import type {ViewProps} from './ViewPropTypes';
12
12
 
13
- import flattenStyle from '../../StyleSheet/flattenStyle';
14
13
  import TextAncestor from '../../Text/TextAncestor';
15
14
  import ViewNativeComponent from './ViewNativeComponent';
16
15
  import * as React from 'react';
@@ -53,7 +52,6 @@ const View: React.AbstractComponent<
53
52
  id,
54
53
  importantForAccessibility,
55
54
  nativeID,
56
- pointerEvents,
57
55
  tabIndex,
58
56
  ...otherProps
59
57
  }: ViewProps,
@@ -96,12 +94,6 @@ const View: React.AbstractComponent<
96
94
  };
97
95
  }
98
96
 
99
- // $FlowFixMe[underconstrained-implicit-instantiation]
100
- let style = flattenStyle(otherProps.style);
101
-
102
- // $FlowFixMe[sketchy-null-mixed]
103
- const newPointerEvents = style?.pointerEvents || pointerEvents;
104
-
105
97
  const actualView = (
106
98
  <ViewNativeComponent
107
99
  {...otherProps}
@@ -120,9 +112,6 @@ const View: React.AbstractComponent<
120
112
  : importantForAccessibility
121
113
  }
122
114
  nativeID={id ?? nativeID}
123
- style={style}
124
- // $FlowFixMe[incompatible-type]
125
- pointerEvents={newPointerEvents}
126
115
  ref={forwardedRef}
127
116
  />
128
117
  );