UNPKG

@niku/react-native-dropdown-select

Version:
24 lines (23 loc) 1.18 kB
import React, { Children, createElement } from 'react'; import { StyleSheet } from 'react-native'; export function isFunction(f) { return typeof f === 'function'; } export function isEmptyChildren(children) { return Children.count(children) === 0; } export function isDropdownOptionItem(option) { return option !== null && typeof option === 'object' ? 'value' in option && 'label' in option : false; } export function isDropdownOptionGroup(option) { return option !== null && typeof option === 'object' ? 'options' in option && 'label' in option : false; } export function getRenderComponent(props, component, render, node) { return component ? /*#__PURE__*/createElement(component, props) : render ? render(props) : node ? isFunction(node) ? node(props) : !isEmptyChildren(node) ? React.Children.only(node) : null : null; } export function getPaddingLeft(style) { var _ref, _style$paddingLeft; style = StyleSheet.flatten(style); return (_ref = (_style$paddingLeft = style.paddingLeft) !== null && _style$paddingLeft !== void 0 ? _style$paddingLeft : style.paddingHorizontal) !== null && _ref !== void 0 ? _ref : style.padding; } //# sourceMappingURL=utils.js.map