react-native 0.87.0-rc.0 → 0.87.0-rc.2

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 (70) hide show
  1. package/Libraries/Core/InitializeCore.js +9 -1
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/ReactNative/AppRegistry.flow.js +1 -0
  4. package/Libraries/ReactNative/AppRegistryImpl.js +2 -3
  5. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +5 -116
  6. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +5 -31
  7. package/React/Base/RCTVersion.m +1 -1
  8. package/React/I18n/RCTLocalizedString.mm +38 -2
  9. package/React-Core-prebuilt.podspec +45 -17
  10. package/React-Core.podspec +9 -2
  11. package/ReactAndroid/external-artifacts/build.gradle.kts +49 -0
  12. package/ReactAndroid/gradle.properties +1 -1
  13. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SynchronousMountItem.kt +8 -2
  14. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  15. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  16. package/index.js +15 -3
  17. package/index.js.flow +0 -2
  18. package/package.json +27 -29
  19. package/react-native.config.js +81 -0
  20. package/scripts/cocoapods/fabric.rb +1 -1
  21. package/scripts/cocoapods/rncore.rb +35 -78
  22. package/scripts/cocoapods/rncore_facades.rb +232 -0
  23. package/scripts/cocoapods/rndependencies.rb +64 -3
  24. package/scripts/cocoapods/rndeps_facades.rb +193 -0
  25. package/scripts/cocoapods/spm.rb +78 -11
  26. package/scripts/codegen/templates/Package.swift.spm-template +97 -0
  27. package/scripts/react-native-xcode.sh +20 -0
  28. package/scripts/react_native_pods.rb +65 -16
  29. package/scripts/replace-rncore-version.js +53 -6
  30. package/scripts/setup-apple-spm.js +1165 -0
  31. package/scripts/spm/__doc__/rfc-spm-xcframework.md +707 -0
  32. package/scripts/spm/__doc__/spm-autolinking-plugins.md +244 -0
  33. package/scripts/spm/__doc__/spm-header-paths-contract.md +97 -0
  34. package/scripts/spm/__doc__/spm-plugins-assessment.md +128 -0
  35. package/scripts/spm/__doc__/spm-scripts.md +451 -0
  36. package/scripts/spm/autolinking-plugins.js +331 -0
  37. package/scripts/spm/download-spm-artifacts.js +1409 -0
  38. package/scripts/spm/expand-spm-dependencies.js +216 -0
  39. package/scripts/spm/flavored-frameworks.js +1008 -0
  40. package/scripts/spm/generate-spm-autolinking-config.js +161 -0
  41. package/scripts/spm/generate-spm-autolinking.js +1888 -0
  42. package/scripts/spm/generate-spm-package.js +302 -0
  43. package/scripts/spm/generate-spm-xcodeproj.js +2224 -0
  44. package/scripts/spm/read-podspec.js +695 -0
  45. package/scripts/spm/scaffold-package-swift.js +1206 -0
  46. package/scripts/spm/spm-pbxproj.js +654 -0
  47. package/scripts/spm/spm-types.js +517 -0
  48. package/scripts/spm/spm-utils.js +645 -0
  49. package/scripts/spm/sync-spm-autolinking.js +160 -0
  50. package/sdks/.hermesv1version +1 -0
  51. package/sdks/hermes-engine/utils/replace_hermes_version.js +18 -4
  52. package/sdks/hermes-engine/version.properties +1 -1
  53. package/src/asset-registry.js +1 -1
  54. package/src/react-private-interface.js +145 -0
  55. package/src/react-private-interface.js.flow +48 -0
  56. package/src/setup-env.js +22 -0
  57. package/src/unstable-internals-do-not-use.d.ts +214 -0
  58. package/src/unstable-internals-do-not-use.js +76 -0
  59. package/third-party-podspecs/ReactNativeDependencies.podspec +2 -2
  60. package/types_generated/Libraries/ReactNative/AppRegistry.flow.d.ts +2 -2
  61. package/types_generated/Libraries/ReactPrivate/ReactNativePrivateInterface.d.ts +6 -21
  62. package/types_generated/index.d.ts +1 -2
  63. package/types_generated/src/private/renderer/events/dispatchNativeEvent.d.ts +26 -0
  64. package/types_generated/src/react-private-interface.d.ts +33 -0
  65. package/Libraries/Utilities/SceneTracker.js +0 -42
  66. package/jest-preset.js +0 -26
  67. package/rn-get-polyfills.js +0 -13
  68. package/types/tsconfig.json +0 -17
  69. package/types_generated/Libraries/Components/Touchable/Touchable.d.ts +0 -261
  70. package/types_generated/tsconfig.test.json +0 -17
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ /**
14
+ * sync-spm-autolinking.js – Lightweight script invoked by the Xcode pre-build
15
+ * phase to re-run invariant codegen and autolinking output when dependency
16
+ * inputs have changed.
17
+ *
18
+ * Usage (called from the Xcode build phase shell script):
19
+ * node sync-spm-autolinking.js --app-root <path> --react-native-root <path>
20
+ *
21
+ * The autolinking config (autolinking.json) is generated by the caller
22
+ * (setup-apple-spm.js) BEFORE this script runs, so codegen below can reuse it
23
+ * (findCodegenEnabledLibraries short-circuits on a present autolinking.json)
24
+ * and the slow `@react-native-community/cli config` runs exactly once per sync.
25
+ *
26
+ * This script:
27
+ * 0. Runs react-native codegen → build/generated/ios/ (reuses autolinking.json)
28
+ * 1. Installs the codegen template into build/generated/ios/Package.swift,
29
+ * replacing codegen's mis-rooted default (done immediately, before any
30
+ * step below that can throw — see the failure-atomicity comment at the
31
+ * call site)
32
+ * 2. Calls generate-spm-autolinking.js → build/generated/autolinking/Package.swift
33
+ * 3. Rebuilds the generated-headers farm
34
+ * 4. Writes build/generated/autolinking/.spm-sync-stamp
35
+ *
36
+ * Runtime frameworks are deliberately not downloaded or regenerated from an
37
+ * Xcode build. `spm add` / `spm update` own the immutable dual-flavor slots and
38
+ * the app target's linker/embed configuration.
39
+ */
40
+
41
+ const {main: generateAutolinking} = require('./generate-spm-autolinking');
42
+ const {
43
+ RemoteVersionError,
44
+ buildPerAppHeaderTree,
45
+ findProjectRoot,
46
+ installSpmCodegenTemplate,
47
+ makeLogger,
48
+ runCodegenAndInstallTemplate,
49
+ } = require('./spm-utils');
50
+ const fs = require('fs');
51
+ const path = require('path');
52
+ const yargs = require('yargs');
53
+
54
+ const {log} = makeLogger('sync-spm-autolinking');
55
+
56
+ // Collaborators are injected (with these real implementations as defaults) so
57
+ // main() can be exercised end-to-end in tests without mocking the module
58
+ // system. Tests pass fakes that record calls and point defaultCacheDir at a
59
+ // tempdir; everything fs-based runs for real against that tempdir.
60
+ const defaultDeps = {
61
+ runCodegenAndInstallTemplate,
62
+ generateAutolinking,
63
+ installSpmCodegenTemplate,
64
+ buildPerAppHeaderTree,
65
+ findProjectRoot,
66
+ };
67
+
68
+ async function main(
69
+ argv /*:: ?: Array<string> */,
70
+ overrides /*:: ?: Partial<typeof defaultDeps> */,
71
+ ) /*: Promise<void> */ {
72
+ const deps = {...defaultDeps, ...(overrides ?? {})};
73
+ const parsed = yargs(argv ?? process.argv.slice(2))
74
+ .version(false)
75
+ .option('app-root', {
76
+ type: 'string',
77
+ demandOption: true,
78
+ describe: 'Path to the app directory',
79
+ })
80
+ .option('react-native-root', {
81
+ type: 'string',
82
+ demandOption: true,
83
+ describe: 'Path to react-native package root',
84
+ })
85
+ .help()
86
+ .parseSync();
87
+
88
+ const appRoot = path.resolve(parsed['app-root']);
89
+ const reactNativeRoot = path.resolve(parsed['react-native-root']);
90
+ const projectRoot = deps.findProjectRoot(appRoot);
91
+
92
+ // The caller (setup-apple-spm.js) already generated autolinking.json before
93
+ // invoking this script, so codegen reuses it here.
94
+ try {
95
+ deps.runCodegenAndInstallTemplate(
96
+ projectRoot,
97
+ appRoot,
98
+ reactNativeRoot,
99
+ {log},
100
+ {
101
+ installTemplate: false,
102
+ },
103
+ );
104
+ } catch {
105
+ log('Codegen failed — continuing with existing output');
106
+ }
107
+
108
+ // Install the codegen template right away, before artifact download and
109
+ // autolinking-plugin execution below. Failure-atomicity: generateAutolinking
110
+ // runs fail-closed plugins that can throw, and if that happens before the
111
+ // template is installed, codegen's mis-rooted default manifest is left in
112
+ // build/generated/ios/Package.swift — breaking every subsequent Xcode
113
+ // "Resolve Package Graph". Installing it immediately after codegen means a
114
+ // later throw can never leave that broken manifest in place.
115
+ deps.installSpmCodegenTemplate(appRoot, reactNativeRoot, {log});
116
+
117
+ log('Re-generating build/generated/autolinking/Package.swift...');
118
+ deps.generateAutolinking([
119
+ '--app-root',
120
+ appRoot,
121
+ '--react-native-root',
122
+ reactNativeRoot,
123
+ ]);
124
+
125
+ // Rebuild the per-app generated-headers farm (vended as the ReactAppHeaders
126
+ // SPM target inside the codegen package). React core headers need no trees
127
+ // — they are vended by the invariant ReactHeaders/ReactNativeHeaders products.
128
+ // The
129
+ // generated manifests are fully declarative (fixed-relative package paths),
130
+ // so no path-locator JSON is written.
131
+ deps.buildPerAppHeaderTree(appRoot, {log});
132
+
133
+ const stampPath = path.join(
134
+ appRoot,
135
+ 'build',
136
+ 'generated',
137
+ 'autolinking',
138
+ '.spm-sync-stamp',
139
+ );
140
+ fs.mkdirSync(path.dirname(stampPath), {recursive: true});
141
+ fs.writeFileSync(stampPath, new Date().toISOString() + '\n', 'utf8');
142
+ log('SPM autolinking sync complete.');
143
+ }
144
+
145
+ if (require.main === module) {
146
+ main().catch(e => {
147
+ if (e instanceof RemoteVersionError) {
148
+ // Clean message + exit 2 (the build phase hard-fails on it) instead of a
149
+ // stack trace, matching how setup-apple-spm.js surfaces remote-mode
150
+ // version errors.
151
+ log(e.message);
152
+ process.exitCode = 2;
153
+ return;
154
+ }
155
+ console.error(e);
156
+ process.exitCode = 1;
157
+ });
158
+ }
159
+
160
+ module.exports = {main};
@@ -0,0 +1 @@
1
+ hermes-v250829098.0.16
@@ -14,7 +14,7 @@ const {spawnSync} = require('child_process');
14
14
  const fs = require('fs');
15
15
  const yargs = require('yargs');
16
16
 
17
- const LAST_BUILD_FILENAME = '.last_build_configuration';
17
+ const LAST_BUILD_FILENAME = 'hermes-engine/.last_build_configuration';
18
18
 
19
19
  function validateBuildConfiguration(configuration) {
20
20
  if (!['Debug', 'Release'].includes(configuration)) {
@@ -56,15 +56,29 @@ function shouldReplaceHermesConfiguration(configuration) {
56
56
  function replaceHermesConfiguration(configuration, version, podsRoot) {
57
57
  const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/hermes-ios-${version.toLowerCase()}-${configuration.toLowerCase()}.tar.gz`;
58
58
 
59
+ if (!fs.existsSync(tarballURLPath)) {
60
+ throw new Error(`Hermes tarball not found at ${tarballURLPath}`);
61
+ }
62
+
59
63
  const finalLocation = 'hermes-engine';
60
64
  console.log('Preparing the final location');
61
65
  fs.rmSync(finalLocation, {force: true, recursive: true});
62
66
  fs.mkdirSync(finalLocation, {recursive: true});
63
67
 
64
68
  console.log('Extracting the tarball');
65
- spawnSync('tar', ['-xf', tarballURLPath, '-C', finalLocation], {
66
- stdio: 'inherit',
67
- });
69
+ const result = spawnSync(
70
+ 'tar',
71
+ ['-xf', tarballURLPath, '-C', finalLocation],
72
+ {
73
+ stdio: 'inherit',
74
+ },
75
+ );
76
+ if (result.status !== 0) {
77
+ fs.rmSync(finalLocation, {force: true, recursive: true});
78
+ throw new Error(
79
+ `Failed to extract ${tarballURLPath}: ${result.error?.message ?? `tar exited with status ${result.status}`}`,
80
+ );
81
+ }
68
82
  }
69
83
 
70
84
  function updateLastBuildConfiguration(configuration) {
@@ -1 +1 @@
1
- HERMES_VERSION_NAME=250829098.0.13
1
+ HERMES_VERSION_NAME=250829098.0.16
@@ -11,7 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  // ----------------------------------------------------------------------------
14
- // Secondary react-native/asset-registry entry point.
14
+ // react-native/asset-registry
15
15
  //
16
16
  // This is an untyped secondary entry point intended to be referenced from
17
17
  // Metro's `transformer.assetRegistryPath` config option. This entry point may
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ // ----------------------------------------------------------------------------
14
+ // react-native/react-private-interface
15
+ //
16
+ // This is a private entry point allowing React to require React Native
17
+ // internals (previously, Libaries/ReactNativePrivateInterface.js).
18
+ //
19
+ // These APIs should ONLY be used by first party React internals and are not
20
+ // part of our public API.
21
+ //
22
+ // IMPORTANT: Keep this file in sync with react-private-interface.js.flow.
23
+ // ----------------------------------------------------------------------------
24
+
25
+ import typeof BatchedBridge from '../Libraries/BatchedBridge/BatchedBridge';
26
+ import typeof legacySendAccessibilityEvent from '../Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent';
27
+ import typeof TextInputState from '../Libraries/Components/TextInput/TextInputState';
28
+ import typeof ExceptionsManager from '../Libraries/Core/ExceptionsManager';
29
+ import typeof RawEventEmitter from '../Libraries/Core/RawEventEmitter';
30
+ import typeof ReactFiberErrorDialog from '../Libraries/Core/ReactFiberErrorDialog';
31
+ import typeof RCTEventEmitter from '../Libraries/EventEmitter/RCTEventEmitter';
32
+ import typeof {
33
+ createPublicInstance,
34
+ createPublicRootInstance,
35
+ createPublicTextInstance,
36
+ getInternalInstanceHandleFromPublicInstance,
37
+ getNativeTagFromPublicInstance,
38
+ getNodeFromPublicInstance,
39
+ } from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
40
+ import typeof {
41
+ create as createAttributePayload,
42
+ diff as diffAttributePayloads,
43
+ } from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload';
44
+ import typeof UIManager from '../Libraries/ReactNative/UIManager';
45
+ import typeof * as ReactNativeViewConfigRegistry from '../Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
46
+ import typeof flattenStyle from '../Libraries/StyleSheet/flattenStyle';
47
+ import type {DangerouslyImpreciseStyleProp} from '../Libraries/StyleSheet/StyleSheet';
48
+ import typeof deepFreezeAndThrowOnMutationInDev from '../Libraries/Utilities/deepFreezeAndThrowOnMutationInDev';
49
+ import typeof deepDiffer from '../Libraries/Utilities/differ/deepDiffer';
50
+ import typeof Platform from '../Libraries/Utilities/Platform';
51
+ import typeof dispatchNativeEvent from './private/renderer/events/dispatchNativeEvent';
52
+ import typeof CustomEvent from './private/webapis/dom/events/CustomEvent';
53
+
54
+ export type {PublicRootInstance} from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
55
+ export type PublicTextInstance = ReturnType<createPublicTextInstance>;
56
+
57
+ // flowlint unsafe-getters-setters:off
58
+ // eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
59
+ module.exports = {
60
+ get BatchedBridge(): BatchedBridge {
61
+ return require('../Libraries/BatchedBridge/BatchedBridge').default;
62
+ },
63
+ get ExceptionsManager(): ExceptionsManager {
64
+ return require('../Libraries/Core/ExceptionsManager').default;
65
+ },
66
+ get Platform(): Platform {
67
+ return require('../Libraries/Utilities/Platform').default;
68
+ },
69
+ get RCTEventEmitter(): RCTEventEmitter {
70
+ return require('../Libraries/EventEmitter/RCTEventEmitter').default;
71
+ },
72
+ get ReactNativeViewConfigRegistry(): ReactNativeViewConfigRegistry {
73
+ return require('../Libraries/Renderer/shims/ReactNativeViewConfigRegistry');
74
+ },
75
+ get TextInputState(): TextInputState {
76
+ return require('../Libraries/Components/TextInput/TextInputState').default;
77
+ },
78
+ get UIManager(): UIManager {
79
+ return require('../Libraries/ReactNative/UIManager').default;
80
+ },
81
+ // TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads`
82
+ get deepDiffer(): deepDiffer {
83
+ return require('../Libraries/Utilities/differ/deepDiffer').default;
84
+ },
85
+ get deepFreezeAndThrowOnMutationInDev(): deepFreezeAndThrowOnMutationInDev<
86
+ {...} | Array<unknown>,
87
+ > {
88
+ return require('../Libraries/Utilities/deepFreezeAndThrowOnMutationInDev')
89
+ .default;
90
+ },
91
+ // TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads`
92
+ get flattenStyle(): flattenStyle<DangerouslyImpreciseStyleProp> {
93
+ // $FlowFixMe[underconstrained-implicit-instantiation]
94
+ // $FlowFixMe[incompatible-type]
95
+ return require('../Libraries/StyleSheet/flattenStyle').default;
96
+ },
97
+ get ReactFiberErrorDialog(): ReactFiberErrorDialog {
98
+ return require('../Libraries/Core/ReactFiberErrorDialog').default;
99
+ },
100
+ get legacySendAccessibilityEvent(): legacySendAccessibilityEvent {
101
+ return require('../Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent')
102
+ .default;
103
+ },
104
+ get RawEventEmitter(): RawEventEmitter {
105
+ return require('../Libraries/Core/RawEventEmitter').default;
106
+ },
107
+ get CustomEvent(): CustomEvent {
108
+ return require('./private/webapis/dom/events/CustomEvent').default;
109
+ },
110
+ get createAttributePayload(): createAttributePayload {
111
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload')
112
+ .create;
113
+ },
114
+ get diffAttributePayloads(): diffAttributePayloads {
115
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload')
116
+ .diff;
117
+ },
118
+ get createPublicRootInstance(): createPublicRootInstance {
119
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
120
+ .createPublicRootInstance;
121
+ },
122
+ get createPublicInstance(): createPublicInstance {
123
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
124
+ .createPublicInstance;
125
+ },
126
+ get createPublicTextInstance(): createPublicTextInstance {
127
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
128
+ .createPublicTextInstance;
129
+ },
130
+ get getNativeTagFromPublicInstance(): getNativeTagFromPublicInstance {
131
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
132
+ .getNativeTagFromPublicInstance;
133
+ },
134
+ get getNodeFromPublicInstance(): getNodeFromPublicInstance {
135
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
136
+ .getNodeFromPublicInstance;
137
+ },
138
+ get getInternalInstanceHandleFromPublicInstance(): getInternalInstanceHandleFromPublicInstance {
139
+ return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
140
+ .getInternalInstanceHandleFromPublicInstance;
141
+ },
142
+ get dispatchNativeEvent(): dispatchNativeEvent {
143
+ return require('./private/renderer/events/dispatchNativeEvent').default;
144
+ },
145
+ };
@@ -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
+ */
10
+
11
+ // ----------------------------------------------------------------------------
12
+ // Types entry point for react-native/react-private-interface
13
+ //
14
+ // IMPORTANT: Keep this file in sync with react-private-interface.js.
15
+ // ----------------------------------------------------------------------------
16
+
17
+ import typeof {createPublicTextInstance as createPublicTextInstanceT} from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
18
+
19
+ export type {PublicRootInstance} from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
20
+ export type PublicTextInstance = ReturnType<createPublicTextInstanceT>;
21
+
22
+ export {default as BatchedBridge} from '../Libraries/BatchedBridge/BatchedBridge';
23
+ export {default as ExceptionsManager} from '../Libraries/Core/ExceptionsManager';
24
+ export {default as Platform} from '../Libraries/Utilities/Platform';
25
+ export {default as RCTEventEmitter} from '../Libraries/EventEmitter/RCTEventEmitter';
26
+ export * as ReactNativeViewConfigRegistry from '../Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
27
+ export {default as TextInputState} from '../Libraries/Components/TextInput/TextInputState';
28
+ export {default as UIManager} from '../Libraries/ReactNative/UIManager';
29
+ export {default as deepDiffer} from '../Libraries/Utilities/differ/deepDiffer';
30
+ export {default as deepFreezeAndThrowOnMutationInDev} from '../Libraries/Utilities/deepFreezeAndThrowOnMutationInDev';
31
+ export {default as flattenStyle} from '../Libraries/StyleSheet/flattenStyle';
32
+ export {default as ReactFiberErrorDialog} from '../Libraries/Core/ReactFiberErrorDialog';
33
+ export {default as legacySendAccessibilityEvent} from '../Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent';
34
+ export {default as RawEventEmitter} from '../Libraries/Core/RawEventEmitter';
35
+ export {default as CustomEvent} from './private/webapis/dom/events/CustomEvent';
36
+ export {
37
+ create as createAttributePayload,
38
+ diff as diffAttributePayloads,
39
+ } from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload';
40
+ export {
41
+ createPublicRootInstance,
42
+ createPublicInstance,
43
+ createPublicTextInstance,
44
+ getNativeTagFromPublicInstance,
45
+ getNodeFromPublicInstance,
46
+ getInternalInstanceHandleFromPublicInstance,
47
+ } from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
48
+ export {default as dispatchNativeEvent} from './private/renderer/events/dispatchNativeEvent';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+ 'use client';
13
+
14
+ // ----------------------------------------------------------------------------
15
+ // react-native/setup-env
16
+ //
17
+ // Side-effectful module that sets up the core React Native JavaScript
18
+ // environment. This includes global timers (`setTimeout` etc), the global
19
+ // `console` object, and hooks for printing stack traces with source maps.
20
+ // ----------------------------------------------------------------------------
21
+
22
+ require('./private/setup/setUpDefaultReactNativeEnvironment').default();
@@ -0,0 +1,214 @@
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
+ * @format
8
+ */
9
+
10
+ // ----------------------------------------------------------------------------
11
+ // Types entry point for react-native/unstable-internals-do-not-use.
12
+ //
13
+ // IMPORTANT: Keep this file in sync with unstable-internals-do-not-use.js.
14
+ // ----------------------------------------------------------------------------
15
+
16
+ import type * as React from 'react';
17
+
18
+ // #region AppContainer
19
+
20
+ interface AppContainerProps {
21
+ children?: React.ReactNode | undefined;
22
+ rootTag: number;
23
+ initialProps?: object | undefined;
24
+ WrapperComponent?: React.ComponentType<any> | null | undefined;
25
+ rootViewStyle?: unknown | undefined;
26
+ internal_excludeLogBox?: boolean | undefined;
27
+ internal_excludeInspector?: boolean | undefined;
28
+ }
29
+
30
+ /** Root component that wraps and mounts a React Native app tree. */
31
+ export const AppContainer: React.ComponentType<AppContainerProps>;
32
+
33
+ // #endregion
34
+ // #region AssetSourceResolver
35
+
36
+ interface ResolvedAssetSource {
37
+ readonly __packager_asset: boolean;
38
+ readonly width: number | null | undefined;
39
+ readonly height: number | null | undefined;
40
+ readonly uri: string;
41
+ readonly scale: number;
42
+ }
43
+
44
+ /** Resolves a packager asset descriptor to a loadable source for the current platform. */
45
+ export class AssetSourceResolver {
46
+ serverUrl: string | null | undefined;
47
+ jsbundleUrl: string | null | undefined;
48
+ asset: unknown;
49
+ constructor(
50
+ serverUrl: string | null | undefined,
51
+ jsbundleUrl: string | null | undefined,
52
+ asset: unknown,
53
+ );
54
+ isLoadedFromServer(): boolean;
55
+ isLoadedFromFileSystem(): boolean;
56
+ defaultAsset(): ResolvedAssetSource;
57
+ getAssetUsingResolver(resolver: 'android' | 'generic'): ResolvedAssetSource;
58
+ assetServerURL(): ResolvedAssetSource;
59
+ scaledAssetPath(): ResolvedAssetSource;
60
+ scaledAssetURLNearBundle(): ResolvedAssetSource;
61
+ resourceIdentifierWithoutScale(): ResolvedAssetSource;
62
+ drawableFolderInBundle(): ResolvedAssetSource;
63
+ fromSource(source: string): ResolvedAssetSource;
64
+ static pickScale(scales: number[], deviceScale?: number): number;
65
+ }
66
+
67
+ // #endregion
68
+ // #region customDirectEventTypes
69
+
70
+ /** Registry mapping custom direct (non-bubbling) event names to their registration names. */
71
+ export const customDirectEventTypes: {
72
+ [eventName: string]: Readonly<{
73
+ registrationName: string;
74
+ }>;
75
+ };
76
+
77
+ // #endregion
78
+ // #region DevLoadingView
79
+
80
+ /** Dev-only overlay banner showing bundle load, refresh, and error status. */
81
+ export const DevLoadingView: {
82
+ showMessage(
83
+ message: string,
84
+ type: 'load' | 'refresh' | 'error',
85
+ options?: {dismissButton?: boolean | undefined},
86
+ ): void;
87
+ hide(): void;
88
+ };
89
+
90
+ // #endregion
91
+ // #region getDevServer
92
+
93
+ interface DevServerInfo {
94
+ url: string;
95
+ fullBundleUrl: string | null;
96
+ bundleLoadedFromServer: boolean;
97
+ }
98
+
99
+ /** Returns information about the running dev server. */
100
+ export function getDevServer(): DevServerInfo;
101
+
102
+ // #endregion
103
+ // #region HMRClient
104
+
105
+ /** Client that receives Fast Refresh updates and applies them at runtime. */
106
+ export class HMRClient {
107
+ enable(): void;
108
+ disable(): void;
109
+ registerBundle(requestUrl: string): void;
110
+ log(
111
+ level:
112
+ | 'trace'
113
+ | 'info'
114
+ | 'warn'
115
+ | 'error'
116
+ | 'log'
117
+ | 'group'
118
+ | 'groupCollapsed'
119
+ | 'groupEnd'
120
+ | 'debug',
121
+ data: ReadonlyArray<unknown>,
122
+ ): void;
123
+ setup(
124
+ platform: string,
125
+ bundleEntry: string,
126
+ host: string,
127
+ port: number | string,
128
+ isEnabled: boolean,
129
+ scheme?: string,
130
+ ): void;
131
+ }
132
+
133
+ // #endregion
134
+ // #region NativeExceptionsManager
135
+
136
+ interface StackFrame {
137
+ column: number | null;
138
+ file: string | null;
139
+ lineNumber: number | null;
140
+ methodName: string;
141
+ collapse?: boolean | undefined;
142
+ }
143
+
144
+ interface ExceptionData {
145
+ message: string;
146
+ originalMessage: string | null;
147
+ name: string | null;
148
+ componentStack: string | null;
149
+ stack: StackFrame[];
150
+ id: number;
151
+ isFatal: boolean;
152
+ extraData?: object | undefined;
153
+ }
154
+
155
+ /** Reports JS exceptions to native and manages RedBox. */
156
+ export const NativeExceptionsManager: {
157
+ reportFatalException(
158
+ message: string,
159
+ stack: StackFrame[],
160
+ exceptionId: number,
161
+ ): void;
162
+ reportSoftException(
163
+ message: string,
164
+ stack: StackFrame[],
165
+ exceptionId: number,
166
+ ): void;
167
+ dismissRedbox(): void;
168
+ reportException(data: ExceptionData): void;
169
+ };
170
+
171
+ // #endregion
172
+ // #region NativeRedBox
173
+
174
+ interface NativeRedBoxSpec {
175
+ setExtraData(extraData: object, forIdentifier: string): void;
176
+ dismiss(): void;
177
+ }
178
+
179
+ /** Native module for the RedBox error overlay; null when unavailable. */
180
+ export const NativeRedBox: NativeRedBoxSpec | null;
181
+
182
+ // #endregion
183
+ // #region NativeSourceCode
184
+
185
+ interface SourceCodeConstants {
186
+ scriptURL: string;
187
+ }
188
+
189
+ /** Native module exposing source-code constants such as the bundle scriptURL. */
190
+ export const NativeSourceCode: {
191
+ getConstants(): SourceCodeConstants;
192
+ };
193
+
194
+ // #endregion
195
+ // #region PressabilityDebugView
196
+
197
+ type Rect = Readonly<{
198
+ bottom?: number | null | undefined;
199
+ left?: number | null | undefined;
200
+ right?: number | null | undefined;
201
+ top?: number | null | undefined;
202
+ }>;
203
+
204
+ type RectOrSize = Rect | number;
205
+
206
+ interface PressabilityDebugViewProps {
207
+ color: unknown;
208
+ hitSlop: RectOrSize | null | undefined;
209
+ }
210
+
211
+ /** Debug overlay that visualizes press targets when enabled via the Inspector. */
212
+ export const PressabilityDebugView: React.ComponentType<PressabilityDebugViewProps>;
213
+
214
+ // #endregion