react-native-web-infinite-swiper
Version:
Simple swiper / slider. Works both on React-Native and React-Native-Web with infinite scroll feature.
22 lines (20 loc) • 574 B
JavaScript
import React from 'react';
export const renderNode = (Component, content, defaultProps) => {
if (content == null || content === false) {
return null;
}
if (React.isValidElement(content)) {
return content;
}
if (typeof content === 'function') {
return content();
}
// Just in case
if (content === true) {
return <Component {...defaultProps} />;
}
if (typeof content === 'string' || typeof content === 'number') {
return <Component {...defaultProps}>{content}</Component>;
}
return <Component {...defaultProps} {...content} />;
};