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
21 lines (19 loc) • 786 B
JavaScript
import React from 'react';
/**
* 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.
*/
export const renderPropComponent = Component => {
// Check if the component is a valid React element and render it if so
if ( /*#__PURE__*/React.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.createElement(Component, null);
}
// Return null if none of the above conditions are met
return null;
};
//# sourceMappingURL=render-prop-component.js.map