import React, { FunctionComponent } from 'react' import classNames from 'classnames' import { View } from '@tarojs/components' import { ComponentDefaults } from '@/utils/typings' import { useRtl } from '@/packages/configprovider/index.taro' import HoverButtonItem from '@/packages/hoverbuttonitem/index.taro' import SafeArea from '@/packages/safearea/index.taro' import { pxTransform } from '@/utils/taro/px-transform' import { UI_BOTTOM_DISTANCE } from '@/packages/hoverbutton/utils' import { TaroHoverButtonProps } from '@/types' const defaultProps = { ...ComponentDefaults, } as TaroHoverButtonProps const classPrefix = 'nut-hoverbutton' export const HoverButton: FunctionComponent> & { Item: typeof HoverButtonItem } = (props) => { const { children, zIndex, tabbarHeight, className, style, icon, onClick } = { ...defaultProps, ...props, } const rtl = useRtl() const baseStyle = { ...style } if (tabbarHeight) { baseStyle.bottom = pxTransform(tabbarHeight + UI_BOTTOM_DISTANCE) } if (typeof zIndex !== 'undefined') { baseStyle.zIndex = zIndex } return ( {children || (icon && )} ) } HoverButton.displayName = 'NutHoverButton' HoverButton.Item = HoverButtonItem