@office-iss/react-native-win32 0.82.0-preview.3 → 0.83.0-preview.0

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 (109) hide show
  1. package/.flowconfig +2 -2
  2. package/CHANGELOG.json +15979 -15955
  3. package/CHANGELOG.md +26 -22
  4. package/IntegrationTests/ImageCachePolicyTest.js +1 -1
  5. package/Libraries/Animated/components/AnimatedFlatList.js +5 -3
  6. package/Libraries/Animated/components/AnimatedImage.js +4 -3
  7. package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
  8. package/Libraries/Animated/components/AnimatedText.js +7 -3
  9. package/Libraries/Animated/components/AnimatedView.js +3 -2
  10. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  11. package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
  12. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +43 -15
  13. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +43 -15
  14. package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +2 -2
  15. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +2 -2
  16. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +2 -2
  17. package/Libraries/Components/RefreshControl/RefreshControl.d.ts +3 -3
  18. package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +2 -2
  19. package/Libraries/Components/ScrollView/ScrollView.js +1 -0
  20. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -6
  21. package/Libraries/Components/Switch/Switch.d.ts +2 -2
  22. package/Libraries/Components/TextInput/TextInput.d.ts +2 -5
  23. package/Libraries/Components/TextInput/TextInput.js +6 -0
  24. package/Libraries/Components/TextInput/TextInput.win32.js +18 -12
  25. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -2
  26. package/Libraries/Components/Touchable/TouchableBounce.js +7 -7
  27. package/Libraries/Components/Touchable/TouchableWin32.js +9 -6
  28. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  29. package/Libraries/Components/View/ReactNativeStyleAttributes.js +19 -1
  30. package/Libraries/Components/View/View.d.ts +2 -2
  31. package/Libraries/Components/View/View.win32.js +17 -15
  32. package/Libraries/Components/View/ViewNativeComponent.js +13 -1
  33. package/Libraries/Components/View/ViewWin32.d.ts +2 -2
  34. package/Libraries/Components/View/ViewWin32.js +1 -1
  35. package/Libraries/Core/ReactNativeVersion.js +3 -3
  36. package/Libraries/Core/setUpPerformance.js +2 -0
  37. package/Libraries/Debugging/DebuggingOverlay.js +14 -14
  38. package/Libraries/Debugging/DebuggingOverlayRegistry.js +8 -2
  39. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -2
  40. package/Libraries/Image/Image.d.ts +3 -3
  41. package/Libraries/Image/ImageInjection.js +3 -6
  42. package/Libraries/Image/ImageTypes.flow.js +3 -7
  43. package/Libraries/Lists/FlatList.js +8 -8
  44. package/Libraries/Lists/SectionList.d.ts +5 -1
  45. package/Libraries/Lists/ViewabilityHelper.js +1 -1
  46. package/Libraries/Lists/VirtualizedList.js +1 -0
  47. package/Libraries/LogBox/UI/AnsiHighlight.js +4 -1
  48. package/Libraries/NativeComponent/BaseViewConfig.android.js +11 -2
  49. package/Libraries/NativeComponent/NativeComponentRegistry.d.ts +98 -0
  50. package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -0
  51. package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +3 -1
  52. package/Libraries/Network/RCTNetworking.android.js +3 -1
  53. package/Libraries/Network/RCTNetworking.ios.js +3 -0
  54. package/Libraries/Network/RCTNetworking.win32.js +3 -0
  55. package/Libraries/Network/XMLHttpRequest.js +1 -41
  56. package/Libraries/Pressability/Pressability.win32.js +5 -5
  57. package/Libraries/Pressability/usePressability.js +14 -3
  58. package/Libraries/ReactNative/PaperUIManager.win32.js +7 -7
  59. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +20 -82
  60. package/Libraries/ReactNative/getNativeComponentAttributes.js +12 -0
  61. package/Libraries/Renderer/implementations/ReactFabric-dev.js +6759 -4478
  62. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3169 -3119
  63. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4732 -3535
  64. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +6646 -4070
  65. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3136 -2825
  66. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4761 -3312
  67. package/Libraries/Renderer/shims/ReactNative.js +3 -1
  68. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  69. package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +2 -1
  70. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
  71. package/Libraries/StyleSheet/StyleSheetTypes.js +44 -0
  72. package/Libraries/StyleSheet/processBackgroundPosition.js +284 -0
  73. package/Libraries/StyleSheet/processBackgroundRepeat.js +105 -0
  74. package/Libraries/StyleSheet/processBackgroundSize.js +104 -0
  75. package/Libraries/Text/Text.d.ts +2 -2
  76. package/Libraries/Text/TextNativeComponent.js +10 -0
  77. package/Libraries/Text/TextNativeComponent.win32.js +10 -0
  78. package/Libraries/TurboModule/TurboModuleRegistry.js +3 -9
  79. package/Libraries/Utilities/DevLoadingView.js +14 -6
  80. package/Libraries/Utilities/FocusManager.win32.js +2 -2
  81. package/Libraries/Utilities/HMRClient.js +13 -5
  82. package/flow/bom.js.flow +1 -0
  83. package/index.js +6 -0
  84. package/index.win32.js +130 -207
  85. package/index.win32.js.flow +488 -0
  86. package/jest/mockComponent.js +6 -6
  87. package/jest/setup.js +15 -10
  88. package/overrides.json +16 -10
  89. package/package.json +37 -24
  90. package/src/private/components/virtualview/VirtualView.js +22 -27
  91. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +6 -0
  92. package/src/private/featureflags/ReactNativeFeatureFlags.js +100 -19
  93. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +18 -3
  94. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
  95. package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
  96. package/src/private/webapis/dom/nodes/ReactNativeElement.js +12 -2
  97. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +76 -15
  98. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +1 -0
  99. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  100. package/src/private/webapis/performance/ResourceTiming.js +31 -4
  101. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +4 -1
  102. package/src/private/webapis/performance/specs/NativePerformance.js +3 -0
  103. package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +6 -3
  104. package/src-win/Libraries/Components/View/ViewWin32.d.ts +2 -2
  105. package/src-win/Libraries/Text/Text.d.ts +2 -2
  106. package/src-win/index.win32.js.flow +488 -0
  107. package/types/index.d.ts +1 -0
  108. package/types/public/ReactNativeTypes.d.ts +115 -2
  109. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +0 -152
@@ -8,15 +8,26 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
11
12
  import Pressability, {
12
13
  type EventHandlers,
13
14
  type PressabilityConfig,
14
15
  } from './Pressability';
15
- import {useEffect, useRef} from 'react';
16
+ import {useEffect, useInsertionEffect, useRef} from 'react';
16
17
 
17
18
  declare function usePressability(config: PressabilityConfig): EventHandlers;
18
19
  declare function usePressability(config: null | void): null | EventHandlers;
19
20
 
21
+ // Experiments with using `useInsertionEffect` instead of `useEffect`, which
22
+ // changes whether `Pressability` is configured or reset when inm a hidden
23
+ // Activity. With `useInsertionEffect`, `Pressability` behaves more like a
24
+ // platform control (e.g. Pointer Events), especially with respect to events
25
+ // like focus and blur.
26
+ const useConfigurationEffect =
27
+ ReactNativeFeatureFlags.configurePressabilityDuringInsertion()
28
+ ? useInsertionEffect
29
+ : useEffect;
30
+
20
31
  /**
21
32
  * Creates a persistent instance of `Pressability` that automatically configures
22
33
  * itself and resets. Accepts null `config` to support lazy initialization. Once
@@ -40,7 +51,7 @@ export default function usePressability(
40
51
 
41
52
  // On the initial mount, this is a no-op. On updates, `pressability` will be
42
53
  // re-configured to use the new configuration.
43
- useEffect(() => {
54
+ useConfigurationEffect(() => {
44
55
  if (config != null && pressability != null) {
45
56
  pressability.configure(config);
46
57
  }
@@ -48,7 +59,7 @@ export default function usePressability(
48
59
 
49
60
  // On unmount, reset pending state and timers inside `pressability`. This is
50
61
  // a separate effect because we do not want to reset when `config` changes.
51
- useEffect(() => {
62
+ useConfigurationEffect(() => {
52
63
  if (pressability != null) {
53
64
  return () => {
54
65
  pressability.reset();
@@ -101,22 +101,22 @@ const UIManagerJS: UIManagerJSInterface = {
101
101
  for (const propName of Object.getOwnPropertyNames(
102
102
  Object.getPrototypeOf(NativeUIManager),
103
103
  )) {
104
- // $FlowFixMe
104
+ // $FlowFixMe[incompatible-type]
105
105
  UIManagerJS[propName] = NativeUIManager[propName];
106
106
  }
107
107
  // Windows]
108
108
 
109
- /* $FlowFixMe(>=0.123.0 site=react_native_fb) This comment suppresses an error
109
+ /* $FlowFixMe[cannot-write] (>=0.123.0 site=react_native_fb) This comment suppresses an error
110
110
  * found when Flow v0.123.0 was deployed. To see the error, delete this comment
111
111
  * and run Flow. */
112
112
  //const UIManagerJS = {
113
113
  // ...NativeUIManager,
114
- // $FlowFixMe
114
+ // $FlowFixMe[cannot-write]
115
115
  UIManagerJS.getConstants = getConstants;
116
116
  // },
117
- // $FlowFixMe
117
+ // $FlowFixMe[cannot-write]
118
118
  UIManagerJS.getViewManagerConfig = getViewManagerConfig;
119
- // $FlowFixMe
119
+ // $FlowFixMe[cannot-write]
120
120
  UIManagerJS.hasViewManagerConfig = (viewManagerName: string) =>
121
121
  getViewManagerConfig(viewManagerName) != null;
122
122
 
@@ -130,7 +130,7 @@ UIManagerJS.hasViewManagerConfig = (viewManagerName: string) =>
130
130
  // getViewManagerConfig is implemented on the JSI object, so we don't
131
131
  // need to hook this unless we are running in webdebugger
132
132
  if (!global.nativeCallSyncHook)
133
- // $FlowFixMe
133
+ // $FlowFixMe[prop-missing]
134
134
  NativeUIManager.getViewManagerConfig = UIManagerJS.getViewManagerConfig;
135
135
 
136
136
  function lazifyViewManagerConfig(viewName: string) {
@@ -199,7 +199,7 @@ if (!global.nativeCallSyncHook) {
199
199
  `Accessing view manager configs directly off UIManager via UIManager['${viewManagerName}'] ` +
200
200
  `is no longer supported. Use UIManager.getViewManagerConfig('${viewManagerName}') instead.`,
201
201
  );
202
- // $FlowFixMe
202
+ // $FlowFixMe[incompatible-return]
203
203
  return UIManagerJS.getViewManagerConfig(viewManagerName);
204
204
  },
205
205
  });
@@ -13,124 +13,62 @@
13
13
  * instances and get some data from them (like their instance handle / fiber).
14
14
  */
15
15
 
16
- import type ReactNativeDocumentT from '../../../src/private/webapis/dom/nodes/ReactNativeDocument';
17
- import typeof * as ReactNativeDocumentModuleT from '../../../src/private/webapis/dom/nodes/ReactNativeDocument';
18
- import type ReactNativeElementT from '../../../src/private/webapis/dom/nodes/ReactNativeElement';
19
- import type ReadOnlyTextT from '../../../src/private/webapis/dom/nodes/ReadOnlyText';
20
- import typeof * as RendererProxyT from '../../ReactNative/RendererProxy';
21
16
  import type {
22
17
  InternalInstanceHandle,
23
18
  Node,
24
19
  ViewConfig,
25
20
  } from '../../Renderer/shims/ReactNativeTypes';
26
21
  import type {RootTag} from '../RootTag';
27
- import type ReactFabricHostComponentT from './ReactFabricHostComponent';
28
22
 
29
- import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
23
+ import ReactNativeDocument, {
24
+ createReactNativeDocument,
25
+ } from '../../../src/private/webapis/dom/nodes/ReactNativeDocument';
26
+ import ReactNativeElement from '../../../src/private/webapis/dom/nodes/ReactNativeElement';
27
+ import ReadOnlyText from '../../../src/private/webapis/dom/nodes/ReadOnlyText';
28
+ import * as RendererProxy from '../../ReactNative/RendererProxy';
30
29
 
31
30
  export opaque type PublicRootInstance = mixed;
32
31
 
33
- // Lazy loaded to avoid evaluating the module when using the legacy renderer.
34
- let ReactNativeDocumentModuleObject: ?ReactNativeDocumentModuleT;
35
- let ReactFabricHostComponentClass: Class<ReactFabricHostComponentT>;
36
- let ReactNativeElementClass: Class<ReactNativeElementT>;
37
- let ReadOnlyTextClass: Class<ReadOnlyTextT>;
38
- let RendererProxy: RendererProxyT;
39
-
40
- function getReactNativeDocumentModule(): ReactNativeDocumentModuleT {
41
- if (ReactNativeDocumentModuleObject == null) {
42
- // We initialize this lazily to avoid a require cycle.
43
- ReactNativeDocumentModuleObject = require('../../../src/private/webapis/dom/nodes/ReactNativeDocument');
44
- }
45
-
46
- return ReactNativeDocumentModuleObject;
47
- }
48
-
49
- function getReactNativeElementClass(): Class<ReactNativeElementT> {
50
- if (ReactNativeElementClass == null) {
51
- ReactNativeElementClass =
52
- require('../../../src/private/webapis/dom/nodes/ReactNativeElement').default;
53
- }
54
- return ReactNativeElementClass;
55
- }
56
-
57
- function getReactFabricHostComponentClass(): Class<ReactFabricHostComponentT> {
58
- if (ReactFabricHostComponentClass == null) {
59
- ReactFabricHostComponentClass =
60
- require('./ReactFabricHostComponent').default;
61
- }
62
- return ReactFabricHostComponentClass;
63
- }
64
-
65
- function getReadOnlyTextClass(): Class<ReadOnlyTextT> {
66
- if (ReadOnlyTextClass == null) {
67
- ReadOnlyTextClass =
68
- require('../../../src/private/webapis/dom/nodes/ReadOnlyText').default;
69
- }
70
- return ReadOnlyTextClass;
71
- }
72
-
73
32
  export function createPublicRootInstance(rootTag: RootTag): PublicRootInstance {
74
- if (ReactNativeFeatureFlags.enableAccessToHostTreeInFabric()) {
75
- const ReactNativeDocumentModule = getReactNativeDocumentModule();
76
-
77
- // $FlowExpectedError[incompatible-return]
78
- return ReactNativeDocumentModule.createReactNativeDocument(rootTag);
79
- }
80
-
81
33
  // $FlowExpectedError[incompatible-return]
82
- return null;
34
+ return createReactNativeDocument(rootTag);
83
35
  }
84
36
 
85
37
  export function createPublicInstance(
86
38
  tag: number,
87
39
  viewConfig: ViewConfig,
88
40
  internalInstanceHandle: InternalInstanceHandle,
89
- ownerDocument: ReactNativeDocumentT,
90
- ): ReactFabricHostComponentT | ReactNativeElementT {
91
- if (ReactNativeFeatureFlags.enableAccessToHostTreeInFabric()) {
92
- const ReactNativeElement = getReactNativeElementClass();
93
- return new ReactNativeElement(
94
- tag,
95
- viewConfig,
96
- internalInstanceHandle,
97
- ownerDocument,
98
- );
99
- } else {
100
- const ReactFabricHostComponent = getReactFabricHostComponentClass();
101
- return new ReactFabricHostComponent(
102
- tag,
103
- viewConfig,
104
- internalInstanceHandle,
105
- );
106
- }
41
+ ownerDocument: ReactNativeDocument,
42
+ ): ReactNativeElement {
43
+ return new ReactNativeElement(
44
+ tag,
45
+ viewConfig,
46
+ internalInstanceHandle,
47
+ ownerDocument,
48
+ );
107
49
  }
108
50
 
109
51
  export function createPublicTextInstance(
110
52
  internalInstanceHandle: InternalInstanceHandle,
111
- ownerDocument: ReactNativeDocumentT,
112
- ): ReadOnlyTextT {
113
- const ReadOnlyText = getReadOnlyTextClass();
53
+ ownerDocument: ReactNativeDocument,
54
+ ): ReadOnlyText {
114
55
  return new ReadOnlyText(internalInstanceHandle, ownerDocument);
115
56
  }
116
57
 
117
58
  export function getNativeTagFromPublicInstance(
118
- publicInstance: ReactFabricHostComponentT | ReactNativeElementT,
59
+ publicInstance: ReactNativeElement,
119
60
  ): number {
120
61
  return publicInstance.__nativeTag;
121
62
  }
122
63
 
123
64
  export function getNodeFromPublicInstance(
124
- publicInstance: ReactFabricHostComponentT | ReactNativeElementT,
65
+ publicInstance: ReactNativeElement,
125
66
  ): ?Node {
126
67
  // Avoid loading ReactFabric if using an instance from the legacy renderer.
127
68
  if (publicInstance.__internalInstanceHandle == null) {
128
69
  return null;
129
70
  }
130
71
 
131
- if (RendererProxy == null) {
132
- RendererProxy = require('../../ReactNative/RendererProxy');
133
- }
134
72
  return RendererProxy.getNodeFromInternalInstanceHandle(
135
73
  // $FlowExpectedError[incompatible-type] __internalInstanceHandle is always an InternalInstanceHandle from React when we get here.
136
74
  publicInstance.__internalInstanceHandle,
@@ -138,7 +76,7 @@ export function getNodeFromPublicInstance(
138
76
  }
139
77
 
140
78
  export function getInternalInstanceHandleFromPublicInstance(
141
- publicInstance: ReactFabricHostComponentT | ReactNativeElementT,
79
+ publicInstance: ReactNativeElement,
142
80
  ): InternalInstanceHandle {
143
81
  // TODO(T174762768): Remove this once OSS versions of renderers will be synced.
144
82
  // $FlowExpectedError[prop-missing] Keeping this for backwards-compatibility with the renderers versions in open source.
@@ -17,6 +17,12 @@ const ReactNativeStyleAttributes =
17
17
  const resolveAssetSource = require('../Image/resolveAssetSource').default;
18
18
  const processBackgroundImage =
19
19
  require('../StyleSheet/processBackgroundImage').default;
20
+ const processBackgroundPosition =
21
+ require('../StyleSheet/processBackgroundPosition').default;
22
+ const processBackgroundRepeat =
23
+ require('../StyleSheet/processBackgroundRepeat').default;
24
+ const processBackgroundSize =
25
+ require('../StyleSheet/processBackgroundSize').default;
20
26
  const processColor = require('../StyleSheet/processColor').default;
21
27
  const processColorArray = require('../StyleSheet/processColorArray').default;
22
28
  const processFilter = require('../StyleSheet/processFilter').default;
@@ -203,6 +209,12 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any {
203
209
  return processFilter;
204
210
  case 'BackgroundImage':
205
211
  return processBackgroundImage;
212
+ case 'BackgroundPosition':
213
+ return processBackgroundPosition;
214
+ case 'BackgroundRepeat':
215
+ return processBackgroundRepeat;
216
+ case 'BackgroundSize':
217
+ return processBackgroundSize;
206
218
  case 'ImageSource':
207
219
  return resolveAssetSource;
208
220
  case 'BoxShadow':