react-native-zoom-toolkit
Version:
Smoothly zoom any image, video or component you want!
18 lines • 634 B
JavaScript
import React from 'react';
import { getInvalidChildrenMessage } from '../utils/messages';
export default function withSnapbackValidation(WrappedComponent) {
return props => {
const expectChildren = 1;
const childrenCount = React.Children.count(props.children);
if (childrenCount !== expectChildren) {
const message = getInvalidChildrenMessage({
name: 'SnapbackZoom',
expected: expectChildren,
actual: childrenCount
});
throw new Error(message);
}
return /*#__PURE__*/React.createElement(WrappedComponent, props);
};
}
//# sourceMappingURL=withSnapbackValidation.js.map