mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
673c7617bc
Summary: This adds the `DOMRect` and `DOMRectReadOnly` classes to React Native, mostly following the Web spec. This is a requirement for `node.getBoundingClientRect()`, which we'll implement in React (in https://github.com/facebook/react/blob/main/packages/react-native-renderer/src/ReactFabricHostConfig.js#L134-L323). Changelog: [General][Added] - Added Web-compatible `DOMRect` and `DOMRectReadOnly` classes to the global scope. Reviewed By: ryancat Differential Revision: D42963222 fbshipit-source-id: bf2ed15bfbfd71822cb6f969f8cc0a67c7834333
58 lines
1.6 KiB
JavaScript
58 lines
1.6 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.
|
|
*
|
|
* @format
|
|
* @flow strict-local
|
|
*/
|
|
|
|
/**
|
|
* Sets up global variables typical in most JavaScript environments.
|
|
*
|
|
* 1. Global timers (via `setTimeout` etc).
|
|
* 2. Global console object.
|
|
* 3. Hooks for printing stack traces with source maps.
|
|
*
|
|
* Leaves enough room in the environment for implementing your own:
|
|
*
|
|
* 1. Require system.
|
|
* 2. Bridged modules.
|
|
*
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const start = Date.now();
|
|
|
|
require('./setUpGlobals');
|
|
require('./setUpDOM');
|
|
require('./setUpPerformance');
|
|
require('./setUpErrorHandling');
|
|
require('./polyfillPromise');
|
|
require('./setUpRegeneratorRuntime');
|
|
require('./setUpTimers');
|
|
require('./setUpXHR');
|
|
require('./setUpAlert');
|
|
require('./setUpNavigator');
|
|
require('./setUpBatchedBridge');
|
|
require('./setUpSegmentFetcher');
|
|
if (__DEV__) {
|
|
require('./checkNativeVersion');
|
|
require('./setUpDeveloperTools');
|
|
require('../LogBox/LogBox').default.install();
|
|
}
|
|
|
|
require('../ReactNative/AppRegistry');
|
|
|
|
const GlobalPerformanceLogger = require('../Utilities/GlobalPerformanceLogger');
|
|
// We could just call GlobalPerformanceLogger.markPoint at the top of the file,
|
|
// but then we'd be excluding the time it took to require the logger.
|
|
// Instead, we just use Date.now and backdate the timestamp.
|
|
GlobalPerformanceLogger.markPoint(
|
|
'initializeCore_start',
|
|
GlobalPerformanceLogger.currentTimestamp() - (Date.now() - start),
|
|
);
|
|
GlobalPerformanceLogger.markPoint('initializeCore_end');
|