mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: This sync includes the following changes: - **[86c8c8db7](https://github.com/facebook/react/commit/86c8c8db7 )**: test: Don't retry flushActWork if flushUntilNextPaint threw ([#26121](https://github.com/facebook/react/pull/26121)) //<Sebastian Silbermann>// - **[64acd3918](https://github.com/facebook/react/commit/64acd3918 )**: remove unguarded getRootNode call ([#26152](https://github.com/facebook/react/pull/26152)) //<Josh Story>// - **[71cace4d3](https://github.com/facebook/react/commit/71cace4d3 )**: Migrate testRunner from jasmine2 to jest-circus ([#26144](https://github.com/facebook/react/pull/26144)) //<Ming Ye>// - **[c8510227c](https://github.com/facebook/react/commit/c8510227c )**: Treat displayName as undefined ([#26148](https://github.com/facebook/react/pull/26148)) //<Sebastian Markbåge>// - **[55542bc73](https://github.com/facebook/react/commit/55542bc73 )**: Update jest printBasicPrototype config ([#26142](https://github.com/facebook/react/pull/26142)) //<Ming Ye>// - **[6396b6641](https://github.com/facebook/react/commit/6396b6641 )**: Model Float on Hoistables semantics ([#26106](https://github.com/facebook/react/pull/26106)) //<Josh Story>// - **[ef9f6e77b](https://github.com/facebook/react/commit/ef9f6e77b )**: Enable passing Server References from Server to Client ([#26124](https://github.com/facebook/react/pull/26124)) //<Sebastian Markbåge>// - **[35698311d](https://github.com/facebook/react/commit/35698311d )**: Update jest escapeString config ([#26140](https://github.com/facebook/react/pull/26140)) //<Ming Ye>// - **[6ddcbd4f9](https://github.com/facebook/react/commit/6ddcbd4f9 )**: [flow] enable LTI inference mode ([#26104](https://github.com/facebook/react/pull/26104)) //<Jan Kassens>// - **[53b1f69ba](https://github.com/facebook/react/commit/53b1f69ba )**: Implement unstable_getBoundingClientRect in RN Fabric refs ([#26137](https://github.com/facebook/react/pull/26137)) //<Rubén Norte>// - **[594093496](https://github.com/facebook/react/commit/594093496 )**: Update to Jest 29 ([#26088](https://github.com/facebook/react/pull/26088)) //<Ming Ye>// - **[28fcae062](https://github.com/facebook/react/commit/28fcae062 )**: Add support for SVG `transformOrigin` prop ([#26130](https://github.com/facebook/react/pull/26130)) //<Aravind D>// - **[3ff1540e9](https://github.com/facebook/react/commit/3ff1540e9 )**: Prefer JSX in ReactNoop assertions (to combat out-of-memory test runs) ([#26127](https://github.com/facebook/react/pull/26127)) //<Sebastian Silbermann>// - **[01a0c4e12](https://github.com/facebook/react/commit/01a0c4e12 )**: Add Edge Server Builds for workerd / edge-light ([#26116](https://github.com/facebook/react/pull/26116)) //<Sebastian Markbåge>// - **[f0cf832e1](https://github.com/facebook/react/commit/f0cf832e1 )**: Update Flight Fixture to "use client" instead of .client.js ([#26118](https://github.com/facebook/react/pull/26118)) //<Sebastian Markbåge>// - **[03a216070](https://github.com/facebook/react/commit/03a216070 )**: Rename "dom" fork to "dom-node" and "bun" fork to "dom-bun" ([#26117](https://github.com/facebook/react/pull/26117)) //<Sebastian Markbåge>// - **[4bf2113a1](https://github.com/facebook/react/commit/4bf2113a1 )**: Revert "Move the Webpack manifest config to one level deeper ([#26083](https://github.com/facebook/react/pull/26083))" ([#26111](https://github.com/facebook/react/pull/26111)) //<Sebastian Markbåge>// - **[2ef24145e](https://github.com/facebook/react/commit/2ef24145e )**: [flow] upgrade to 0.199.0 ([#26096](https://github.com/facebook/react/pull/26096)) //<Jan Kassens>// - **[922dd7ba5](https://github.com/facebook/react/commit/922dd7ba5 )**: Revert the outer module object to an object ([#26093](https://github.com/facebook/react/pull/26093)) //<Sebastian Markbåge>// - **[9d111ffdf](https://github.com/facebook/react/commit/9d111ffdf )**: Serialize Promises through Flight ([#26086](https://github.com/facebook/react/pull/26086)) //<Sebastian Markbåge>// - **[0ba4698c7](https://github.com/facebook/react/commit/0ba4698c7 )**: Fix async test in React reconciler ([#26087](https://github.com/facebook/react/pull/26087)) //<Ming Ye>// - **[8c234c0de](https://github.com/facebook/react/commit/8c234c0de )**: Move the Webpack manifest config to one level deeper ([#26083](https://github.com/facebook/react/pull/26083)) //<Sebastian Markbåge>// - **[977bccd24](https://github.com/facebook/react/commit/977bccd24 )**: Refactor Flight Encoding ([#26082](https://github.com/facebook/react/pull/26082)) //<Sebastian Markbåge>// - **[d7bb524ad](https://github.com/facebook/react/commit/d7bb524ad )**: [cleanup] Remove unused package jest-mock-scheduler ([#26084](https://github.com/facebook/react/pull/26084)) //<Ming Ye>// - **[6b3083266](https://github.com/facebook/react/commit/6b3083266 )**: Upgrade prettier ([#26081](https://github.com/facebook/react/pull/26081)) //<Jan Kassens>// - **[1f5ce59dd](https://github.com/facebook/react/commit/1f5ce59dd )**: [cleanup] fully roll out warnAboutSpreadingKeyToJSX ([#26080](https://github.com/facebook/react/pull/26080)) //<Jan Kassens>// Changelog: [General][Changed] - React Native sync for revisions 48b687f...fccf3a9 jest_e2e[run_all_tests] Reviewed By: rubennorte Differential Revision: D43305607 fbshipit-source-id: 8da7567ca2a182f4be27788935c2da30a731f83b
130 lines
3.7 KiB
JavaScript
130 lines
3.7 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @noformat
|
|
* @flow strict-local
|
|
* @generated SignedSource<<47ba85d7f43c9b591d6804827322d00e>>
|
|
*
|
|
* This file was sync'd from the facebook/react repository.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import {type ViewConfig} from './ReactNativeTypes';
|
|
import invariant from 'invariant';
|
|
|
|
// Event configs
|
|
const customBubblingEventTypes: {
|
|
[eventName: string]: $ReadOnly<{
|
|
phasedRegistrationNames: $ReadOnly<{
|
|
captured: string,
|
|
bubbled: string,
|
|
skipBubbling?: ?boolean,
|
|
}>,
|
|
}>,
|
|
...
|
|
} = {};
|
|
const customDirectEventTypes: {
|
|
[eventName: string]: $ReadOnly<{
|
|
registrationName: string,
|
|
}>,
|
|
...
|
|
} = {};
|
|
|
|
exports.customBubblingEventTypes = customBubblingEventTypes;
|
|
exports.customDirectEventTypes = customDirectEventTypes;
|
|
|
|
const viewConfigCallbacks = new Map<string, ?() => ViewConfig>();
|
|
const viewConfigs = new Map<string, ViewConfig>();
|
|
|
|
function processEventTypes(viewConfig: ViewConfig): void {
|
|
const {bubblingEventTypes, directEventTypes} = viewConfig;
|
|
|
|
if (__DEV__) {
|
|
if (bubblingEventTypes != null && directEventTypes != null) {
|
|
for (const topLevelType in directEventTypes) {
|
|
invariant(
|
|
bubblingEventTypes[topLevelType] == null,
|
|
'Event cannot be both direct and bubbling: %s',
|
|
topLevelType,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (bubblingEventTypes != null) {
|
|
for (const topLevelType in bubblingEventTypes) {
|
|
if (customBubblingEventTypes[topLevelType] == null) {
|
|
customBubblingEventTypes[topLevelType] =
|
|
bubblingEventTypes[topLevelType];
|
|
}
|
|
}
|
|
}
|
|
|
|
if (directEventTypes != null) {
|
|
for (const topLevelType in directEventTypes) {
|
|
if (customDirectEventTypes[topLevelType] == null) {
|
|
customDirectEventTypes[topLevelType] = directEventTypes[topLevelType];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Registers a native view/component by name.
|
|
* A callback is provided to load the view config from UIManager.
|
|
* The callback is deferred until the view is actually rendered.
|
|
*/
|
|
exports.register = function (name: string, callback: () => ViewConfig): string {
|
|
invariant(
|
|
!viewConfigCallbacks.has(name),
|
|
'Tried to register two views with the same name %s',
|
|
name,
|
|
);
|
|
invariant(
|
|
typeof callback === 'function',
|
|
'View config getter callback for component `%s` must be a function (received `%s`)',
|
|
name,
|
|
callback === null ? 'null' : typeof callback,
|
|
);
|
|
viewConfigCallbacks.set(name, callback);
|
|
return name;
|
|
};
|
|
|
|
/**
|
|
* Retrieves a config for the specified view.
|
|
* If this is the first time the view has been used,
|
|
* This configuration will be lazy-loaded from UIManager.
|
|
*/
|
|
exports.get = function (name: string): ViewConfig {
|
|
let viewConfig;
|
|
if (!viewConfigs.has(name)) {
|
|
const callback = viewConfigCallbacks.get(name);
|
|
if (typeof callback !== 'function') {
|
|
invariant(
|
|
false,
|
|
'View config getter callback for component `%s` must be a function (received `%s`).%s',
|
|
name,
|
|
callback === null ? 'null' : typeof callback,
|
|
typeof name[0] === 'string' && /[a-z]/.test(name[0])
|
|
? ' Make sure to start component names with a capital letter.'
|
|
: '',
|
|
);
|
|
}
|
|
viewConfig = callback();
|
|
processEventTypes(viewConfig);
|
|
viewConfigs.set(name, viewConfig);
|
|
|
|
// Clear the callback after the config is set so that
|
|
// we don't mask any errors during registration.
|
|
viewConfigCallbacks.set(name, null);
|
|
} else {
|
|
viewConfig = viewConfigs.get(name);
|
|
}
|
|
invariant(viewConfig, 'View config not found for name %s', name);
|
|
return viewConfig;
|
|
};
|