UNPKG

@niku/react-native-dropdown-select

Version:
47 lines (35 loc) 2.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isFunction = isFunction; exports.isEmptyChildren = isEmptyChildren; exports.isDropdownOptionItem = isDropdownOptionItem; exports.isDropdownOptionGroup = isDropdownOptionGroup; exports.getRenderComponent = getRenderComponent; exports.getPaddingLeft = getPaddingLeft; var _react = _interopRequireWildcard(require("react")); var _reactNative = require("react-native"); function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function isFunction(f) { return typeof f === 'function'; } function isEmptyChildren(children) { return _react.Children.count(children) === 0; } function isDropdownOptionItem(option) { return option !== null && typeof option === 'object' ? 'value' in option && 'label' in option : false; } function isDropdownOptionGroup(option) { return option !== null && typeof option === 'object' ? 'options' in option && 'label' in option : false; } function getRenderComponent(props, component, render, node) { return component ? /*#__PURE__*/(0, _react.createElement)(component, props) : render ? render(props) : node ? isFunction(node) ? node(props) : !isEmptyChildren(node) ? _react.default.Children.only(node) : null : null; } function getPaddingLeft(style) { var _ref, _style$paddingLeft; style = _reactNative.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