@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
61 lines (54 loc) • 1.81 kB
JavaScript
import isNil from 'lodash/isNil';
import isUndefined from 'lodash/isUndefined';
import omit from 'lodash/omit';
import pick from 'lodash/pick';
import React, { isValidElement } from 'react';
import { Text } from 'react-native';
import { jsx as _jsx } from "react/jsx-runtime";
export * from "./z-index.js";
export { default as easing } from "./easing.js";
export * from "./interceptor.js";
export * from "./typeof.js";
export * from "./format/number.js";
export * from "./attach-properties-to-component.js";
export * from "./arrow.js";
export { default as childrenToArray } from "./children/to-array.js";
/** 获取默认值 */
export const getDefaultValue = (value, defaultValue) => {
return !isUndefined(value) ? value : defaultValue;
};
/** 渲染类文字的 JSX */
export const renderTextLikeJSX = (node, style, restProps) => {
return !isNil(node) ? /*#__PURE__*/isValidElement(node) ? node : /*#__PURE__*/_jsx(Text, {
...restProps,
style: style,
children: node
}) : null;
};
/** 可点击元素的属性字段 */
export const touchablePropsFields = ['delayLongPress', 'delayPressIn', 'delayPressOut', 'disabled', 'hitSlop', 'onBlur', 'onFocus', 'onLongPress', 'onPress', 'onPressIn', 'onPressOut', 'pressRetentionOffset'];
/**
* 是一个点击节点
*/
export const isTouchableNode = props => {
return Object.keys(props).some(k => {
if (touchablePropsFields.indexOf(k) > -1 && !isNil(props[k])) {
return true;
}
return false;
});
};
/**
* 挑选出点击事件的属性
*/
export const pickTouchablePropsField = props => {
return pick(props, touchablePropsFields);
};
/**
* 排除点击事件的属性
*/
export const omitTouchablePropsField = props => {
return omit(props, touchablePropsFields);
};
//# sourceMappingURL=index.js.map
;