UNPKG

react-native-zoom-toolkit

Version:

Smoothly zoom any image, video or component you want!

25 lines (24 loc) 881 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = withSnapbackValidation; var _react = _interopRequireDefault(require("react")); var _messages = require("../utils/messages"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function withSnapbackValidation(WrappedComponent) { return props => { const expectChildren = 1; const childrenCount = _react.default.Children.count(props.children); if (childrenCount !== expectChildren) { const message = (0, _messages.getInvalidChildrenMessage)({ name: 'SnapbackZoom', expected: expectChildren, actual: childrenCount }); throw new Error(message); } return /*#__PURE__*/_react.default.createElement(WrappedComponent, props); }; } //# sourceMappingURL=withSnapbackValidation.js.map