mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 23:05:00 +08:00
Move stuff out of vendor/react_contrib/
Summary: This was a confusing place for them. BoundingDimensions, Position, and Touchable were only used in Touchable; StaticContainer I moved to Libraries/Components. @public Reviewed By: @vjeux Differential Revision: D2530730 fb-gh-sync-id: e636a6b7259c2bd3ab52c82ebd59a6c66c9e7e7a
This commit is contained in:
committed by
facebook-github-bot-9
parent
264cb8962a
commit
5e33dbcfcc
37
Libraries/Components/Touchable/BoundingDimensions.js
Normal file
37
Libraries/Components/Touchable/BoundingDimensions.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @providesModule BoundingDimensions
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var PooledClass = require('PooledClass');
|
||||
|
||||
var twoArgumentPooler = PooledClass.twoArgumentPooler;
|
||||
|
||||
/**
|
||||
* PooledClass representing the bounding rectangle of a region.
|
||||
*
|
||||
* @param {number} width Width of bounding rectangle.
|
||||
* @param {number} height Height of bounding rectangle.
|
||||
* @constructor BoundingDimensions
|
||||
*/
|
||||
function BoundingDimensions(width, height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} element Element to return `BoundingDimensions` for.
|
||||
* @return {BoundingDimensions} Bounding dimensions of `element`.
|
||||
*/
|
||||
BoundingDimensions.getPooledFromElement = function(element) {
|
||||
return BoundingDimensions.getPooled(
|
||||
element.offsetWidth,
|
||||
element.offsetHeight
|
||||
);
|
||||
};
|
||||
|
||||
PooledClass.addPoolingTo(BoundingDimensions, twoArgumentPooler);
|
||||
|
||||
module.exports = BoundingDimensions;
|
||||
|
||||
Reference in New Issue
Block a user