react-native-full-responsive
Version:
Create a fully responsive React Native app for all supported platforms
17 lines • 1.09 kB
JavaScript
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import { useResponsiveMethods } from '../hooks';
/**
* A HOC for when you want to use full responsive methods in your class components without additional steps as props.
*/
const withResponsiveMethods = Component => {
const displayName = Component.displayName || Component.name || 'Component';
const ComponentWithMethods = props => {
const responsiveMethods = useResponsiveMethods();
return /*#__PURE__*/React.createElement(Component, _extends({}, props, responsiveMethods));
};
ComponentWithMethods.displayName = `withResponsiveMethods(${displayName})`;
return ComponentWithMethods;
};
export { withResponsiveMethods, withResponsiveMethods as withRM };
//# sourceMappingURL=withResponsiveMethods.js.map