uncontrollable
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -18,8 +18,16 @@ "use strict"; | ||
var version = React.version.split(".").map(parseFloat); | ||
function getType(component) { | ||
if (version[0] === 0 && version[1] >= 13) return component; | ||
return component.type; | ||
} | ||
module.exports = function (Component, controlledValues, taps) { | ||
var types = {}; | ||
if (process.env.NODE_ENV !== "production" && Component.type.propTypes) { | ||
if (process.env.NODE_ENV !== "production" && getType(Component).propTypes) { | ||
types = transform(controlledValues, function (obj, handler, prop) { | ||
var type = Component.type.propTypes[prop]; | ||
var type = getType(Component).propTypes[prop]; | ||
@@ -26,0 +34,0 @@ invariant(typeof handler === "string" && handler.trim().length, "Uncontrollable - [%s]: the prop `%s` needs a valid handler key name in order to make it uncontrollable", Component.displayName, prop); |
{ | ||
"name": "uncontrollable", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Wrap a controlled react component, to allow spcific prop/handler pairs to be uncontrolled", | ||
@@ -5,0 +5,0 @@ "author": { |
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
180288
4504