fluxible-addons-react
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -41,3 +41,3 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2"; | ||
function connectToStores(Component, stores, _getStateFromStores, options) { | ||
function connectToStores(Component, stores, getStateFromStores, options) { | ||
var StoreConnector = /*#__PURE__*/function (_ReactComponent) { | ||
@@ -56,4 +56,2 @@ _inherits(StoreConnector, _ReactComponent); | ||
_this._onStoreChange = _this._onStoreChange.bind(_assertThisInitialized(_this)); | ||
_this.getStateFromStores = _this.getStateFromStores.bind(_assertThisInitialized(_this)); | ||
_this.state = _this.getStateFromStores(); | ||
return _this; | ||
@@ -63,12 +61,6 @@ } | ||
_createClass(StoreConnector, [{ | ||
key: "getStateFromStores", | ||
value: function getStateFromStores(props) { | ||
props = props || this.props; | ||
return _getStateFromStores(this.context, props); | ||
} | ||
}, { | ||
key: "_onStoreChange", | ||
value: function _onStoreChange() { | ||
if (this._isMounted) { | ||
this.setState(this.getStateFromStores()); | ||
this.forceUpdate(); | ||
} | ||
@@ -97,12 +89,8 @@ } | ||
}, { | ||
key: "UNSAFE_componentWillReceiveProps", | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
this.setState(this.getStateFromStores(nextProps)); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var storeState = getStateFromStores(this.context, this.props); | ||
return /*#__PURE__*/createElement(Component, _objectSpread(_objectSpread({ | ||
ref: this.props.fluxibleRef | ||
}, this.props), this.state)); | ||
}, this.props), storeState)); | ||
} | ||
@@ -117,3 +105,3 @@ }]); | ||
return /*#__PURE__*/createElement(StoreConnector, _objectSpread(_objectSpread({}, props), {}, { | ||
fluxibleRef: (options === null || options === void 0 ? void 0 : options.forwardRef) ? ref : null | ||
fluxibleRef: options !== null && options !== void 0 && options.forwardRef ? ref : null | ||
})); | ||
@@ -120,0 +108,0 @@ }); |
@@ -13,5 +13,3 @@ /** | ||
* Example: | ||
* const WrappedComponent = provideContext(Component, { | ||
* foo: PropTypes.string | ||
* }); | ||
* const WrappedComponent = provideContext(Component); | ||
* | ||
@@ -18,0 +16,0 @@ * @function provideContext |
@@ -58,3 +58,3 @@ "use strict"; | ||
*/ | ||
function connectToStores(Component, stores, _getStateFromStores, options) { | ||
function connectToStores(Component, stores, getStateFromStores, options) { | ||
var StoreConnector = /*#__PURE__*/function (_ReactComponent) { | ||
@@ -72,4 +72,2 @@ (0, _inherits2["default"])(StoreConnector, _ReactComponent); | ||
_this._onStoreChange = _this._onStoreChange.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this.getStateFromStores = _this.getStateFromStores.bind((0, _assertThisInitialized2["default"])(_this)); | ||
_this.state = _this.getStateFromStores(); | ||
return _this; | ||
@@ -79,12 +77,6 @@ } | ||
(0, _createClass2["default"])(StoreConnector, [{ | ||
key: "getStateFromStores", | ||
value: function getStateFromStores(props) { | ||
props = props || this.props; | ||
return _getStateFromStores(this.context, props); | ||
} | ||
}, { | ||
key: "_onStoreChange", | ||
value: function _onStoreChange() { | ||
if (this._isMounted) { | ||
this.setState(this.getStateFromStores()); | ||
this.forceUpdate(); | ||
} | ||
@@ -113,12 +105,8 @@ } | ||
}, { | ||
key: "UNSAFE_componentWillReceiveProps", | ||
value: function UNSAFE_componentWillReceiveProps(nextProps) { | ||
this.setState(this.getStateFromStores(nextProps)); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var storeState = getStateFromStores(this.context, this.props); | ||
return /*#__PURE__*/(0, _react.createElement)(Component, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({ | ||
ref: this.props.fluxibleRef | ||
}, this.props), this.state)); | ||
}, this.props), storeState)); | ||
} | ||
@@ -132,3 +120,3 @@ }]); | ||
return /*#__PURE__*/(0, _react.createElement)(StoreConnector, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, { | ||
fluxibleRef: (options === null || options === void 0 ? void 0 : options.forwardRef) ? ref : null | ||
fluxibleRef: options !== null && options !== void 0 && options.forwardRef ? ref : null | ||
})); | ||
@@ -135,0 +123,0 @@ }); |
@@ -27,5 +27,3 @@ "use strict"; | ||
* Example: | ||
* const WrappedComponent = provideContext(Component, { | ||
* foo: PropTypes.string | ||
* }); | ||
* const WrappedComponent = provideContext(Component); | ||
* | ||
@@ -32,0 +30,0 @@ * @function provideContext |
{ | ||
"name": "fluxible-addons-react", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Fluxible addons for use with React", | ||
@@ -18,4 +18,4 @@ "main": "dist/lib/index.js", | ||
"pretest": "npm run dist", | ||
"test": "../../node_modules/.bin/mocha tests/unit/", | ||
"cover": "BABEL_ENV=test ../../node_modules/.bin/nyc ../../node_modules/.bin/_mocha tests/unit/", | ||
"test": "../../node_modules/.bin/jest -c ../../jest.config.js", | ||
"cover": "../../node_modules/.bin/jest -c ../../jest.config.js --coverage", | ||
"lint": "../../node_modules/.bin/eslint src/*.js tests/" | ||
@@ -22,0 +22,0 @@ }, |
@@ -27,3 +27,3 @@ # Fluxible Addons for React | ||
|--------------------------|-------------------------------| | ||
| 16.3 | >= 1.x | | ||
| 16.3+ | >= 1.x | | ||
| 16.0 | >= 0.2.14 | | ||
@@ -30,0 +30,0 @@ | 15.0 | >= 0.2.6 | |
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
34802
691