UNPKG

@fruits-chain/react-native-xiaoshu

Version:
69 lines (67 loc) β€’ 1.86 kB
"use strict"; import React, { useMemo, useRef, memo } from 'react'; import { View } from 'react-native'; import { varCreator as varCreatorDivider } from "../divider/style.js"; import { getDefaultValue } from "../helpers/index.js"; import Theme from "../theme/index.js"; import { DropdownConfig } from "./context.js"; import { varCreator, styleCreator } from "./style.js"; /** * DropdownMenu δΈ‹ζ‹‰θœε•ηš„ζ¨ͺ村 */ import { jsx as _jsx } from "react/jsx-runtime"; const DropdownMenu = ({ theme, titleStyle, titleTextStyle, iconStyle, activeColor, direction = 'down', duration, zIndex = 10, // overlay = true, // closeOnPressOverlay = true, closeOnPressOutside = true, divider = true, style, ...restProps }) => { const MenuRef = useRef(null); const [CV, STYLES, TOKENS] = Theme.useStyle({ varCreator, styleCreator, theme }); const [CV_DIVIDER] = Theme.useStyle({ varCreator: varCreatorDivider }); activeColor = getDefaultValue(activeColor, CV.dropdown_active_color); duration = getDefaultValue(duration, TOKENS.animation_duration_fast); const config = useMemo(() => ({ titleStyle, titleTextStyle, iconStyle, activeColor, direction, duration, zIndex, closeOnPressOutside, MenuRef, theme }), [activeColor, closeOnPressOutside, direction, duration, iconStyle, theme, titleStyle, titleTextStyle, zIndex]); const dividerStyle = { borderBottomColor: CV_DIVIDER.divider_color_light, borderBottomWidth: divider ? 1 : 0 }; return /*#__PURE__*/_jsx(DropdownConfig.Provider, { value: config, children: /*#__PURE__*/_jsx(View, { ...restProps, collapsable: false, ref: MenuRef, style: [STYLES.menu, dividerStyle, style] }) }); }; export default /*#__PURE__*/memo(DropdownMenu); //# sourceMappingURL=dropdown-menu.js.map