@office-iss/react-native-win32 0.0.0-canary.256 → 0.0.0-canary.258

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 (64) hide show
  1. package/.flowconfig +4 -2
  2. package/CHANGELOG.json +79 -1
  3. package/CHANGELOG.md +32 -8
  4. package/Libraries/Components/ScrollView/ScrollView.js +124 -165
  5. package/Libraries/Core/InitializeCore.js +2 -0
  6. package/Libraries/Core/ReactNativeVersion.js +3 -3
  7. package/Libraries/Core/ReactNativeVersionCheck.win32.js +1 -1
  8. package/Libraries/Core/setUpGlobals.js +1 -0
  9. package/Libraries/Core/setUpTimers.js +19 -0
  10. package/Libraries/LogBox/Data/LogBoxData.js +39 -4
  11. package/Libraries/LogBox/Data/LogBoxLog.js +5 -2
  12. package/Libraries/LogBox/Data/parseLogBoxLog.js +22 -1
  13. package/Libraries/LogBox/LogBox.js +29 -12
  14. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  15. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  16. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  17. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  18. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  19. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +25 -74
  20. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +27 -80
  21. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  22. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  23. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  24. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  25. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  26. package/Libraries/ReactNative/AppContainer-dev.js +1 -5
  27. package/Libraries/ReactNative/AppContainer-prod.js +1 -5
  28. package/Libraries/ReactNative/AppContainer.js +0 -1
  29. package/Libraries/ReactNative/AppRegistry.js +0 -6
  30. package/Libraries/ReactNative/renderApplication.js +0 -2
  31. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15690 -26405
  32. package/Libraries/Renderer/implementations/ReactFabric-prod.js +2675 -1630
  33. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2945 -1682
  34. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16141 -27018
  35. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +2723 -1666
  36. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +2984 -1737
  37. package/Libraries/Share/Share.d.ts +16 -10
  38. package/Libraries/Share/Share.js +14 -15
  39. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +19 -0
  40. package/Libraries/StyleSheet/StyleSheetTypes.js +19 -1
  41. package/Libraries/StyleSheet/processFilter.js +214 -39
  42. package/Libraries/Text/Text.js +42 -22
  43. package/Libraries/Text/Text.win32.js +42 -22
  44. package/Libraries/Text/TextNativeComponent.js +1 -1
  45. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  46. package/Libraries/Text/TextOptimized.js +538 -0
  47. package/Libraries/Utilities/ReactNativeTestTools.js +7 -24
  48. package/Libraries/__tests__/ButtonWin32-test.js +7 -6
  49. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  50. package/index.js +1 -0
  51. package/index.win32.js +1 -0
  52. package/jest/mockComponent.js +4 -1
  53. package/jest/renderer.js +25 -14
  54. package/jest/setup.js +5 -0
  55. package/overrides.json +6 -6
  56. package/package.json +26 -26
  57. package/src/private/core/components/HScrollViewNativeComponents.js +55 -0
  58. package/src/private/core/components/VScrollViewNativeComponents.js +47 -0
  59. package/src/private/core/components/useSyncOnScroll.js +48 -0
  60. package/src/private/featureflags/ReactNativeFeatureFlags.js +12 -1
  61. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  62. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  63. package/src/private/specs/modules/NativeSampleTurboModule.js +14 -1
  64. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
@@ -20,14 +20,8 @@ const View = require('../Components/View/View');
20
20
  const Text = require('../Text/Text');
21
21
  const {VirtualizedList} = require('@react-native/virtualized-lists');
22
22
  const React = require('react');
23
- const ShallowRenderer = require('react-shallow-renderer');
24
23
  const ReactTestRenderer = require('react-test-renderer');
25
24
 
26
- /* $FlowFixMe[not-a-function] (>=0.125.1 site=react_native_fb) This comment
27
- * suppresses an error found when Flow v0.125.1 was deployed. To see the error,
28
- * delete this comment and run Flow. */
29
- // $FlowFixMe[invalid-constructor]
30
- const shallowRenderer = new ShallowRenderer();
31
25
  export type ReactTestInstance = $PropertyType<ReactTestRendererType, 'root'>;
32
26
  export type Predicate = (node: ReactTestInstance) => boolean;
33
27
  /* $FlowFixMe[value-as-type] (>=0.125.1 site=react_native_fb) This comment
@@ -119,7 +113,7 @@ function expectNoConsoleError() {
119
113
  });
120
114
  }
121
115
 
122
- function expectRendersMatchingSnapshot(
116
+ async function expectRendersMatchingSnapshot(
123
117
  name: string,
124
118
  ComponentProvider: () => React.Element<any>,
125
119
  unmockComponent: () => mixed,
@@ -128,7 +122,9 @@ function expectRendersMatchingSnapshot(
128
122
 
129
123
  jest.resetAllMocks();
130
124
 
131
- instance = ReactTestRenderer.create(<ComponentProvider />);
125
+ await ReactTestRenderer.act(() => {
126
+ instance = ReactTestRenderer.create(<ComponentProvider />);
127
+ });
132
128
  expect(instance).toMatchSnapshot(
133
129
  'should deep render when mocked (please verify output manually)',
134
130
  );
@@ -136,22 +132,9 @@ function expectRendersMatchingSnapshot(
136
132
  jest.resetAllMocks();
137
133
  unmockComponent();
138
134
 
139
- instance = shallowRenderer.render(<ComponentProvider />);
140
- expect(instance).toMatchSnapshot(
141
- `should shallow render as <${name} /> when not mocked`,
142
- );
143
-
144
- jest.resetAllMocks();
145
-
146
- instance = shallowRenderer.render(<ComponentProvider />);
147
- expect(instance).toMatchSnapshot(
148
- `should shallow render as <${name} /> when mocked`,
149
- );
150
-
151
- jest.resetAllMocks();
152
- unmockComponent();
153
-
154
- instance = ReactTestRenderer.create(<ComponentProvider />);
135
+ await ReactTestRenderer.act(() => {
136
+ instance = ReactTestRenderer.create(<ComponentProvider />);
137
+ });
155
138
  expect(instance).toMatchSnapshot(
156
139
  'should deep render when not mocked (please verify output manually)',
157
140
  );
@@ -2,15 +2,16 @@
2
2
  'use strict';
3
3
 
4
4
  const React = require('react');
5
- const ReactTestRenderer = require('react-test-renderer');
5
+ const renderer = require('react-native/jest/renderer');
6
6
 
7
7
  const {ButtonWin32} = require('@office-iss/react-native-win32');
8
8
 
9
9
  describe('ButtonWin32', () => {
10
- it('renders native component', () => {
11
- const component = ReactTestRenderer.create(
12
- <ButtonWin32/>
13
- );
14
- expect(component).toMatchSnapshot();
10
+ it('renders native component', async () => {
11
+ expect(
12
+ await renderer.create(
13
+ <ButtonWin32/>,
14
+ ),
15
+ ).toMatchSnapshot();
15
16
  });
16
17
  });
@@ -52,6 +52,7 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
52
52
  substitutions: [],
53
53
  },
54
54
  componentStack: [],
55
+ componentStackType: null,
55
56
  stack,
56
57
  category: 'possible_unhandled_promise_rejection',
57
58
  });
package/index.js CHANGED
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  'use strict';
12
+ 'use client';
12
13
 
13
14
  // APIs
14
15
  import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS';
package/index.win32.js CHANGED
@@ -9,6 +9,7 @@
9
9
  */
10
10
 
11
11
  'use strict';
12
+ 'use client';
12
13
 
13
14
  // APIs
14
15
  import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS';
@@ -16,7 +16,10 @@ module.exports = (moduleName, instanceMethods, isESModule) => {
16
16
  const React = require('react');
17
17
 
18
18
  const SuperClass =
19
- typeof RealComponent === 'function' ? RealComponent : React.Component;
19
+ typeof RealComponent === 'function' &&
20
+ RealComponent.prototype.constructor instanceof React.Component
21
+ ? RealComponent
22
+ : React.Component;
20
23
 
21
24
  const name =
22
25
  RealComponent.displayName ||
package/jest/renderer.js CHANGED
@@ -9,22 +9,33 @@
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
+ import type {ReactTestRenderer} from 'react-test-renderer';
13
+
14
+ import nullthrows from 'nullthrows';
12
15
  import * as React from 'react';
13
- import ShallowRenderer from 'react-shallow-renderer';
14
16
  import TestRenderer from 'react-test-renderer';
15
17
 
16
- const renderer = new ShallowRenderer();
17
-
18
- export const shallow = (Component: React.Element<any>): any => {
19
- const Wrapper = (): React.Element<any> => Component;
20
-
21
- return renderer.render(<Wrapper />);
22
- };
18
+ export async function create(
19
+ Component: React.Element<any>,
20
+ ): Promise<ReactTestRenderer> {
21
+ let component;
22
+ await TestRenderer.act(async () => {
23
+ component = TestRenderer.create(Component);
24
+ });
25
+ return nullthrows(component);
26
+ }
23
27
 
24
- export const shallowRender = (Component: React.Element<any>): any => {
25
- return renderer.render(Component);
26
- };
28
+ export async function unmount(testRenderer: ReactTestRenderer) {
29
+ await TestRenderer.act(async () => {
30
+ testRenderer.unmount();
31
+ });
32
+ }
27
33
 
28
- export const create = (Component: React.Element<any>): any => {
29
- return TestRenderer.create(Component);
30
- };
34
+ export async function update(
35
+ testRenderer: ReactTestRenderer,
36
+ element: React.Element<any>,
37
+ ) {
38
+ await TestRenderer.act(async () => {
39
+ testRenderer.update(element);
40
+ });
41
+ }
package/jest/setup.js CHANGED
@@ -9,6 +9,11 @@
9
9
 
10
10
  'use strict';
11
11
 
12
+ global.IS_REACT_ACT_ENVIRONMENT = true;
13
+ // Suppress the `react-test-renderer` warnings until New Architecture and legacy
14
+ // mode are no longer supported by React Native.
15
+ global.IS_REACT_NATIVE_TEST_ENVIRONMENT = true;
16
+
12
17
  const MockNativeMethods = jest.requireActual('./MockNativeMethods');
13
18
  const mockComponent = jest.requireActual('./mockComponent');
14
19
 
package/overrides.json CHANGED
@@ -7,19 +7,19 @@
7
7
  "**/__snapshots__/**",
8
8
  "src-win/rntypes/**"
9
9
  ],
10
- "baseVersion": "0.75.0-nightly-20240613-f7aea0c8e",
10
+ "baseVersion": "0.76.0-nightly-20240701-9f6cb21ed",
11
11
  "overrides": [
12
12
  {
13
13
  "type": "derived",
14
14
  "file": ".flowconfig",
15
15
  "baseFile": ".flowconfig",
16
- "baseHash": "0a0c16d79748a5e84407a57c772c3508160134ae"
16
+ "baseHash": "2b0a3c4f44b686f254516c51469500bf26c5b113"
17
17
  },
18
18
  {
19
19
  "type": "derived",
20
20
  "file": "src-win/index.win32.js",
21
21
  "baseFile": "packages/react-native/index.js",
22
- "baseHash": "dd3b224f82882d17be0a79a368b293c9ac6599a0"
22
+ "baseHash": "2690130ef7a40e3fb37fc465979e69b1036cdae8"
23
23
  },
24
24
  {
25
25
  "type": "platform",
@@ -317,7 +317,7 @@
317
317
  "type": "patch",
318
318
  "file": "src-win/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js",
319
319
  "baseFile": "packages/react-native/Libraries/LogBox/UI/LogBoxInspectorHeader.js",
320
- "baseHash": "1a12281b1cfab7352fcfeb5984f0ed3c83c04660",
320
+ "baseHash": "46b6ee5d65a0c820dd0a2415bd8f43e5e8807bae",
321
321
  "issue": 7952
322
322
  },
323
323
  {
@@ -439,13 +439,13 @@
439
439
  "type": "derived",
440
440
  "file": "src-win/Libraries/Text/Text.win32.js",
441
441
  "baseFile": "packages/react-native/Libraries/Text/Text.js",
442
- "baseHash": "24376d16dfc834512d72348e2a434731440146d4"
442
+ "baseHash": "3b40ec7def4177ef81ad2eb84a0f95bc00cec041"
443
443
  },
444
444
  {
445
445
  "type": "derived",
446
446
  "file": "src-win/Libraries/Text/TextNativeComponent.win32.js",
447
447
  "baseFile": "packages/react-native/Libraries/Text/TextNativeComponent.js",
448
- "baseHash": "9f7ea4e5225a06e1ec3bb46a2f4bc9f72bf46873",
448
+ "baseHash": "1b2e6301edc13f3a91e47b9befe8a47a12e6ad39",
449
449
  "issue": 7074
450
450
  },
451
451
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.0.0-canary.256",
3
+ "version": "0.0.0-canary.258",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,31 +12,31 @@
12
12
  "types": "types",
13
13
  "scripts": {
14
14
  "build": "rnw-scripts build",
15
- "bundle": "rnw-scripts prepareBundle && react-native bundle --platform win32 --entry-file ../react-native-win32-tester/js/RNTesterApp.win32.js --bundle-output dist/win32/dev/js/RNTesterApp.bundle --assets-dest dist/win32/dev --sourcemap-output ./dist/win32/dev/js/RNTesterApp.bundle.map",
15
+ "bundle": "rnw-scripts prepareBundle && npx @react-native-community/cli bundle --platform win32 --entry-file ../react-native-win32-tester/js/RNTesterApp.win32.js --bundle-output dist/win32/dev/js/RNTesterApp.bundle --assets-dest dist/win32/dev --sourcemap-output ./dist/win32/dev/js/RNTesterApp.bundle.map",
16
16
  "clean": "rnw-scripts clean",
17
17
  "flow-check": "rnw-scripts flow-check",
18
18
  "lint:fix": "rnw-scripts lint:fix",
19
19
  "lint": "rnw-scripts lint",
20
20
  "run-win32-devmain": "npx @office-iss/rex-win32@0.71.15-devmain.16607.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDevMain --useDirectDebugger --useFastRefresh",
21
21
  "run-win32": "npx @office-iss/rex-win32@0.71.15-devmain.16607.10000 --bundle js/RNTesterApp --component RNTesterApp --basePath ./dist/win32/dev --jsEngine v8 --useDirectDebugger --useFastRefresh",
22
- "start": "react-native start --projectRoot ../react-native-win32-tester",
22
+ "start": "npx @react-native-community/cli start --projectRoot ../react-native-win32-tester",
23
23
  "test": "jest",
24
24
  "validate-overrides": "react-native-platform-override validate"
25
25
  },
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.0.0",
28
28
  "@jest/create-cache-key-function": "^29.6.3",
29
- "@react-native-community/cli": "14.0.0-alpha.2",
30
- "@react-native-community/cli-platform-android": "14.0.0-alpha.2",
31
- "@react-native-community/cli-platform-ios": "14.0.0-alpha.2",
29
+ "@react-native-community/cli": "14.0.0-alpha.11",
30
+ "@react-native-community/cli-platform-android": "14.0.0-alpha.11",
31
+ "@react-native-community/cli-platform-ios": "14.0.0-alpha.11",
32
32
  "@react-native/assets": "1.0.0",
33
- "@react-native/assets-registry": "0.75.0-nightly-20240613-f7aea0c8e",
34
- "@react-native/codegen": "0.75.0-nightly-20240613-f7aea0c8e",
35
- "@react-native/community-cli-plugin": "0.75.0-nightly-20240613-f7aea0c8e",
36
- "@react-native/gradle-plugin": "0.75.0-nightly-20240613-f7aea0c8e",
37
- "@react-native/js-polyfills": "0.75.0-nightly-20240613-f7aea0c8e",
38
- "@react-native/normalize-colors": "0.75.0-nightly-20240613-f7aea0c8e",
39
- "@react-native/virtualized-lists": "0.75.0-nightly-20240613-f7aea0c8e",
33
+ "@react-native/assets-registry": "0.76.0-nightly-20240701-9f6cb21ed",
34
+ "@react-native/codegen": "0.76.0-nightly-20240701-9f6cb21ed",
35
+ "@react-native/community-cli-plugin": "0.76.0-nightly-20240701-9f6cb21ed",
36
+ "@react-native/gradle-plugin": "0.76.0-nightly-20240701-9f6cb21ed",
37
+ "@react-native/js-polyfills": "0.76.0-nightly-20240701-9f6cb21ed",
38
+ "@react-native/normalize-colors": "0.76.0-nightly-20240701-9f6cb21ed",
39
+ "@react-native/virtualized-lists": "0.76.0-nightly-20240701-9f6cb21ed",
40
40
  "abort-controller": "^3.0.0",
41
41
  "anser": "^1.4.9",
42
42
  "ansi-regex": "^5.0.0",
@@ -57,27 +57,27 @@
57
57
  "pretty-format": "^26.5.2",
58
58
  "promise": "^8.3.0",
59
59
  "react-clone-referenced-element": "^1.0.1",
60
- "react-devtools-core": "5.1.0",
60
+ "react-devtools-core": "^5.3.0",
61
61
  "react-refresh": "^0.14.0",
62
62
  "react-shallow-renderer": "^16.15.0",
63
63
  "regenerator-runtime": "^0.13.2",
64
- "scheduler": "0.24.0-canary-efb381bbf-20230505",
64
+ "scheduler": "0.25.0-rc-fb9a90fa48-20240614",
65
65
  "semver": "^7.1.3",
66
66
  "stacktrace-parser": "^0.1.10",
67
67
  "whatwg-fetch": "^3.0.0",
68
- "ws": "^6.2.2",
68
+ "ws": "^6.2.3",
69
69
  "yargs": "^17.6.2"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@babel/core": "^7.20.0",
73
73
  "@babel/eslint-parser": "^7.20.0",
74
- "@react-native/metro-config": "0.75.0-nightly-20240613-f7aea0c8e",
74
+ "@react-native/metro-config": "0.76.0-nightly-20240701-9f6cb21ed",
75
75
  "@rnw-scripts/babel-react-native-config": "0.0.0",
76
- "@rnw-scripts/eslint-config": "1.2.24",
77
- "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.28",
78
- "@rnw-scripts/just-task": "2.3.41",
76
+ "@rnw-scripts/eslint-config": "1.2.26",
77
+ "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.30",
78
+ "@rnw-scripts/just-task": "2.3.43",
79
79
  "@rnw-scripts/metro-dev-config": "0.0.0",
80
- "@rnx-kit/jest-preset": "^0.1.0",
80
+ "@rnx-kit/jest-preset": "^0.1.17",
81
81
  "@types/node": "^18.0.0",
82
82
  "@types/prop-types": "15.7.1",
83
83
  "@types/react": "^18.2.6",
@@ -86,15 +86,15 @@
86
86
  "jscodeshift": "^0.14.0",
87
87
  "just-scripts": "^1.3.3",
88
88
  "prettier": "2.8.8",
89
- "react": "18.3.1",
90
- "react-native": "0.75.0-nightly-20240613-f7aea0c8e",
91
- "react-native-platform-override": "^1.9.43",
89
+ "react": "19.0.0-rc-fb9a90fa48-20240614",
90
+ "react-native": "0.76.0-nightly-20240701-9f6cb21ed",
91
+ "react-native-platform-override": "^1.9.45",
92
92
  "typescript": "5.0.4"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "@types/react": "^18.2.6",
96
- "react": "^18.2.0",
97
- "react-native": "0.75.0-nightly-20240613-f7aea0c8e"
96
+ "react": "^19.0.0-rc-fb9a90fa48-20240614",
97
+ "react-native": "0.76.0-nightly-20240701-9f6cb21ed"
98
98
  },
99
99
  "beachball": {
100
100
  "defaultNpmTag": "canary",
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import type {ScrollViewNativeProps} from '../../../../Libraries/Components/ScrollView/ScrollViewNativeComponentType';
13
+ import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
14
+ import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
15
+ import type {TScrollViewNativeImperativeHandle} from './useSyncOnScroll';
16
+
17
+ import AndroidHorizontalScrollViewNativeComponent from '../../../../Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent';
18
+ import ScrollContentViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollContentViewNativeComponent';
19
+ import ScrollViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollViewNativeComponent';
20
+ import Platform from '../../../../Libraries/Utilities/Platform';
21
+ import AndroidHorizontalScrollContentViewNativeComponent from '../../specs/components/AndroidHorizontalScrollContentViewNativeComponent';
22
+ import useSyncOnScroll from './useSyncOnScroll';
23
+ import * as React from 'react';
24
+
25
+ const HScrollViewNativeComponentForPlatform =
26
+ Platform.OS === 'android'
27
+ ? AndroidHorizontalScrollViewNativeComponent
28
+ : ScrollViewNativeComponent;
29
+
30
+ export const HScrollViewNativeComponent: React.AbstractComponent<
31
+ ScrollViewNativeProps,
32
+ TScrollViewNativeImperativeHandle,
33
+ // $FlowExpectedError[incompatible-type] - Flow cannot model imperative handles, yet.
34
+ > = function HScrollViewNativeComponent(props: {
35
+ ...ScrollViewNativeProps,
36
+ ref?: React.RefSetter<TScrollViewNativeImperativeHandle | null>,
37
+ ...
38
+ }): React.Node {
39
+ const [ref, enableSyncOnScroll] = useSyncOnScroll(props.ref);
40
+ // NOTE: When `useSyncOnScroll` triggers an update, `props` will not have
41
+ // changed. Notably, `props.children` will be the same, allowing React to
42
+ // bail out during reconciliation.
43
+ return (
44
+ <HScrollViewNativeComponentForPlatform
45
+ {...props}
46
+ ref={ref}
47
+ enableSyncOnScroll={enableSyncOnScroll}
48
+ />
49
+ );
50
+ };
51
+
52
+ export const HScrollContentViewNativeComponent: HostComponent<ViewProps> =
53
+ Platform.OS === 'android'
54
+ ? AndroidHorizontalScrollContentViewNativeComponent
55
+ : ScrollContentViewNativeComponent;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import type {ScrollViewNativeProps} from '../../../../Libraries/Components/ScrollView/ScrollViewNativeComponentType';
13
+ import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
14
+ import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
15
+ import type {TScrollViewNativeImperativeHandle} from './useSyncOnScroll';
16
+
17
+ import ScrollContentViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollContentViewNativeComponent';
18
+ import ScrollViewNativeComponent from '../../../../Libraries/Components/ScrollView/ScrollViewNativeComponent';
19
+ import View from '../../../../Libraries/Components/View/View';
20
+ import Platform from '../../../../Libraries/Utilities/Platform';
21
+ import useSyncOnScroll from './useSyncOnScroll';
22
+ import * as React from 'react';
23
+
24
+ export const VScrollViewNativeComponent: React.AbstractComponent<
25
+ ScrollViewNativeProps,
26
+ TScrollViewNativeImperativeHandle,
27
+ // $FlowExpectedError[incompatible-type] - Flow cannot model imperative handles, yet.
28
+ > = function VScrollViewNativeComponent(props: {
29
+ ...ScrollViewNativeProps,
30
+ ref?: React.RefSetter<TScrollViewNativeImperativeHandle | null>,
31
+ ...
32
+ }): React.Node {
33
+ const [ref, enableSyncOnScroll] = useSyncOnScroll(props.ref);
34
+ // NOTE: When `useSyncOnScroll` triggers an update, `props` will not have
35
+ // changed. Notably, `props.children` will be the same, allowing React to
36
+ // bail out during reconciliation.
37
+ return (
38
+ <ScrollViewNativeComponent
39
+ {...props}
40
+ ref={ref}
41
+ enableSyncOnScroll={enableSyncOnScroll}
42
+ />
43
+ );
44
+ };
45
+
46
+ export const VScrollContentViewNativeComponent: HostComponent<ViewProps> =
47
+ Platform.OS === 'android' ? View : ScrollContentViewNativeComponent;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import type {ScrollViewNativeProps} from '../../../../Libraries/Components/ScrollView/ScrollViewNativeComponentType';
13
+ import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
14
+
15
+ import * as React from 'react';
16
+ import {useImperativeHandle, useRef, useState} from 'react';
17
+
18
+ export type TScrollViewNativeComponentInstance = React.ElementRef<
19
+ HostComponent<ScrollViewNativeProps>,
20
+ >;
21
+
22
+ export type TScrollViewNativeImperativeHandle = {
23
+ componentRef: React.RefObject<TScrollViewNativeComponentInstance | null>,
24
+ unstable_setEnableSyncOnScroll: (enabled: true) => void,
25
+ };
26
+
27
+ /**
28
+ * Hook used by `HScrollViewNativeComponent` and `VScrollViewNativeComponent`
29
+ * to make an implementation of `unstable_setEnableSyncOnScroll` available that
30
+ * does not require updating all `ScrollView` children.
31
+ */
32
+ export default function useSyncOnScroll(
33
+ inputRef: ?React.RefSetter<TScrollViewNativeImperativeHandle | null>,
34
+ ): [React.RefSetter<TScrollViewNativeComponentInstance | null>, true | void] {
35
+ const componentRef = useRef<TScrollViewNativeComponentInstance | null>(null);
36
+ const [enableSyncOnScroll, setEnableSyncOnScroll] = useState<true | void>();
37
+
38
+ useImperativeHandle<TScrollViewNativeImperativeHandle>(inputRef, () => {
39
+ return {
40
+ componentRef,
41
+ unstable_setEnableSyncOnScroll(enabled: true): void {
42
+ setEnableSyncOnScroll(enabled);
43
+ },
44
+ };
45
+ }, []);
46
+
47
+ return [componentRef, enableSyncOnScroll];
48
+ }
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<870e25c844e692bb04ee49fe20cd3baf>>
7
+ * @generated SignedSource<<522f11a571457cb932f451cf81bd384a>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -32,6 +32,7 @@ export type ReactNativeFeatureFlagsJsOnly = {
32
32
  enableAccessToHostTreeInFabric: Getter<boolean>,
33
33
  isLayoutAnimationEnabled: Getter<boolean>,
34
34
  shouldUseAnimatedObjectForTransform: Getter<boolean>,
35
+ shouldUseOptimizedText: Getter<boolean>,
35
36
  shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
36
37
  shouldUseSetNativePropsInFabric: Getter<boolean>,
37
38
  };
@@ -51,6 +52,7 @@ export type ReactNativeFeatureFlags = {
51
52
  enableMicrotasks: Getter<boolean>,
52
53
  enableSynchronousStateUpdates: Getter<boolean>,
53
54
  enableUIConsistency: Getter<boolean>,
55
+ fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean>,
54
56
  fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak: Getter<boolean>,
55
57
  forceBatchingMountItemsOnAndroid: Getter<boolean>,
56
58
  fuseboxEnabledDebug: Getter<boolean>,
@@ -96,6 +98,11 @@ export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGet
96
98
  */
97
99
  export const shouldUseAnimatedObjectForTransform: Getter<boolean> = createJavaScriptFlagGetter('shouldUseAnimatedObjectForTransform', false);
98
100
 
101
+ /**
102
+ * Use optimized version of <Text /> component.
103
+ */
104
+ export const shouldUseOptimizedText: Getter<boolean> = createJavaScriptFlagGetter('shouldUseOptimizedText', false);
105
+
99
106
  /**
100
107
  * removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android
101
108
  */
@@ -150,6 +157,10 @@ export const enableSynchronousStateUpdates: Getter<boolean> = createNativeFlagGe
150
157
  * Ensures that JavaScript always has a consistent view of the state of the UI (e.g.: commits done in other threads are not immediately propagated to JS during its execution).
151
158
  */
152
159
  export const enableUIConsistency: Getter<boolean> = createNativeFlagGetter('enableUIConsistency', false);
160
+ /**
161
+ * Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.
162
+ */
163
+ export const fixMappingOfEventPrioritiesBetweenFabricAndReact: Getter<boolean> = createNativeFlagGetter('fixMappingOfEventPrioritiesBetweenFabricAndReact', false);
153
164
  /**
154
165
  * Fixes a leak in SurfaceMountingManager.mRemoveDeleteTreeUIFrameCallback
155
166
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<6922b452333fc62a263bd77d42afbbbe>>
7
+ * @generated SignedSource<<6715ba4954b31464c591597c53a2a0de>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -34,6 +34,7 @@ export interface Spec extends TurboModule {
34
34
  +enableMicrotasks?: () => boolean;
35
35
  +enableSynchronousStateUpdates?: () => boolean;
36
36
  +enableUIConsistency?: () => boolean;
37
+ +fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
37
38
  +fixStoppedSurfaceRemoveDeleteTreeUIFrameCallbackLeak?: () => boolean;
38
39
  +forceBatchingMountItemsOnAndroid?: () => boolean;
39
40
  +fuseboxEnabledDebug?: () => boolean;
@@ -21,6 +21,7 @@ export interface Spec extends TurboModule {
21
21
  +setProfilingEnabled: (isProfilingEnabled: boolean) => void;
22
22
  +toggleElementInspector: () => void;
23
23
  +addMenuItem: (title: string) => void;
24
+ +openDebugger?: () => void;
24
25
 
25
26
  // Events
26
27
  +addListener: (eventName: string) => void;
@@ -12,7 +12,10 @@ import type {
12
12
  RootTag,
13
13
  TurboModule,
14
14
  } from '../../../../Libraries/TurboModule/RCTExport';
15
- import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';
15
+ import type {
16
+ EventEmitter,
17
+ UnsafeObject,
18
+ } from '../../../../Libraries/Types/CodegenTypes';
16
19
 
17
20
  import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
18
21
 
@@ -21,7 +24,17 @@ export enum EnumInt {
21
24
  B = 42,
22
25
  }
23
26
 
27
+ export type ObjectStruct = {
28
+ a: number,
29
+ b: string,
30
+ c?: ?string,
31
+ };
32
+
24
33
  export interface Spec extends TurboModule {
34
+ +onPress: EventEmitter<void>;
35
+ +onClick: EventEmitter<string>;
36
+ +onChange: EventEmitter<ObjectStruct>;
37
+ +onSubmit: EventEmitter<ObjectStruct[]>;
25
38
  // Exported methods.
26
39
  +getConstants: () => {|
27
40
  const1: boolean,
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ import type {TurboModule} from '../../../../../Libraries/TurboModule/RCTExport';
12
+
13
+ import * as TurboModuleRegistry from '../../../../../Libraries/TurboModule/TurboModuleRegistry';
14
+
15
+ export type RequestIdleCallbackOptions = {
16
+ timeout?: number,
17
+ };
18
+
19
+ export type IdleDeadline = {
20
+ didTimeout: boolean,
21
+ timeRemaining: () => mixed,
22
+ };
23
+
24
+ export interface Spec extends TurboModule {
25
+ +requestIdleCallback: (
26
+ callback: (idleDeadline: IdleDeadline) => mixed,
27
+ options?: RequestIdleCallbackOptions,
28
+ ) => mixed;
29
+ +cancelIdleCallback: (handle: mixed) => void;
30
+ }
31
+
32
+ export default (TurboModuleRegistry.getEnforcing<Spec>(
33
+ 'NativeIdleCallbacksCxx',
34
+ ): Spec);