react-native-flexible-grid
Version:
React Native Flexible Grid is an advanced grid layout system inspired by CSS Grid, designed to facilitate responsive, customizable, and dynamic grid layouts in React Native applications. It supports both responsive and fixed layouts, enabling the creation
28 lines (26 loc) • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.renderPropComponent = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Determine which to render, a React component or element.
* @param {React.ComponentType<any> | React.ReactElement} Component - The component to render.
* @returns {React.ReactElement} The rendered component or element.
*/
const renderPropComponent = Component => {
// Check if the component is a valid React element and render it if so
if (/*#__PURE__*/_react.default.isValidElement(Component)) {
return Component;
}
// Otherwise, check if the component is a function or class component and invoke it
else if (typeof Component === 'function') {
return /*#__PURE__*/_react.default.createElement(Component, null);
}
// Return null if none of the above conditions are met
return null;
};
exports.renderPropComponent = renderPropComponent;
//# sourceMappingURL=render-prop-component.js.map