@avinlab/react-size-me
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -9,1 +9,4 @@ Changelog | ||
Using `element-resize-detector` to catch container's resize events | ||
# 1.1.1 | ||
Always render child even before size calculations to save refs |
@@ -27,4 +27,4 @@ 'use strict'; | ||
_this.state = { | ||
width: _this.props.defaultHeight || null, | ||
height: _this.props.defaultHeight || null | ||
width: _this.props.defaultHeight || 0, | ||
height: _this.props.defaultHeight || 0 | ||
}; | ||
@@ -72,16 +72,14 @@ | ||
if (typeof children === 'function') { | ||
if (width !== null && height !== null) { | ||
var params = {}; | ||
var params = {}; | ||
if (!disableHeight) { | ||
params.height = height; | ||
} | ||
if (!disableHeight) { | ||
params.height = height; | ||
} | ||
if (!disableWidth) { | ||
params.width = width; | ||
} | ||
if (!disableWidth) { | ||
params.width = width; | ||
} | ||
onResize(params); | ||
return children(params); | ||
} | ||
onResize(params); | ||
return children(params); | ||
} | ||
@@ -88,0 +86,0 @@ }; |
@@ -23,4 +23,4 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
_this.state = { | ||
width: _this.props.defaultHeight || null, | ||
height: _this.props.defaultHeight || null | ||
width: _this.props.defaultHeight || 0, | ||
height: _this.props.defaultHeight || 0 | ||
}; | ||
@@ -68,16 +68,14 @@ | ||
if (typeof children === 'function') { | ||
if (width !== null && height !== null) { | ||
var params = {}; | ||
var params = {}; | ||
if (!disableHeight) { | ||
params.height = height; | ||
} | ||
if (!disableHeight) { | ||
params.height = height; | ||
} | ||
if (!disableWidth) { | ||
params.width = width; | ||
} | ||
if (!disableWidth) { | ||
params.width = width; | ||
} | ||
onResize(params); | ||
return children(params); | ||
} | ||
onResize(params); | ||
return children(params); | ||
} | ||
@@ -84,0 +82,0 @@ }; |
{ | ||
"name": "@avinlab/react-size-me", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "React components for determine parent container size", | ||
@@ -39,3 +39,3 @@ "author": "Avin Grape <carcinogen75@gmail.com> (https://github.com/avin/)", | ||
"build:source": "rollup -c", | ||
"deploy": "rimraf demo && build:demo", | ||
"deploy": "rimraf demo && npm run build:demo && gh-pages -d demo -r https://github.com/avin/react-size-me", | ||
"flow": "flow check --max-warnings=0 src && flow check website", | ||
@@ -42,0 +42,0 @@ "linc": "lint-staged", |
# react-size-me | ||
> React components for determine parent container size | ||
> React component to determine parent container size | ||
[![NPM registry](https://img.shields.io/npm/v/react-size-me.svg?style=for-the-badge)](https://yarnpkg.com/en/package/react-size-me) [![Travis](https://img.shields.io/badge/ci-travis-green.svg?style=for-the-badge)](https://travis-ci.org/bvaughn/react-size-me) [![NPM license](https://img.shields.io/badge/license-mit-red.svg?style=for-the-badge)](LICENSE) | ||
[![NPM registry](https://img.shields.io/npm/v/@avinlab/react-size-me.svg?style=for-the-badge)](https://yarnpkg.com/en/package/@avinlab/react-size-me) [![NPM license](https://img.shields.io/badge/license-mit-red.svg?style=for-the-badge)](LICENSE) | ||
## Demo | ||
Here is an [examples page](https://avin.github.io/react-size-me) | ||
## Install | ||
@@ -8,0 +12,0 @@ |
@@ -49,4 +49,4 @@ //@flow | ||
type State = { | ||
height: ?number, | ||
width: ?number, | ||
height: number, | ||
width: number, | ||
}; | ||
@@ -67,4 +67,4 @@ | ||
state = { | ||
width: this.props.defaultHeight || null, | ||
height: this.props.defaultHeight || null, | ||
width: this.props.defaultHeight || 0, | ||
height: this.props.defaultHeight || 0, | ||
}; | ||
@@ -106,15 +106,13 @@ | ||
if (typeof children === 'function') { | ||
if (width !== null && height !== null) { | ||
const params = {}; | ||
if (!disableHeight) { | ||
params.height = height; | ||
} | ||
if (!disableWidth) { | ||
params.width = width; | ||
} | ||
const params = {}; | ||
if (!disableHeight) { | ||
params.height = height; | ||
} | ||
if (!disableWidth) { | ||
params.width = width; | ||
} | ||
onResize(params); | ||
onResize(params); | ||
return children(params); | ||
} | ||
return children(params); | ||
} | ||
@@ -121,0 +119,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40
0
14416
278