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
19 lines
602 B
JavaScript
19 lines
602 B
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.
|
|
*
|
|
* @flow strict
|
|
* @format
|
|
*/
|
|
|
|
import DOMRect from '../DOM/Geometry/DOMRect';
|
|
import DOMRectReadOnly from '../DOM/Geometry/DOMRectReadOnly';
|
|
|
|
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
|
global.DOMRect = DOMRect;
|
|
|
|
// $FlowExpectedError[cannot-write] The global isn't writable anywhere but here, where we define it
|
|
global.DOMRectReadOnly = DOMRectReadOnly;
|