zmp-react
Version:
Build full featured iOS & Android apps using ZMP & React
47 lines (46 loc) • 1.37 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
import Toolbar from '../components/toolbar';
import { classNames } from '../shared/utils';
/* dts-props
id?: string | number;
className?: string;
style?: React.CSSProperties;
labels? : boolean
scrollable? : boolean
hidden? : boolean
noShadow? : boolean
noHairline? : boolean
position? : string
top? : boolean
bottom? : boolean
fill?: boolean
COLOR_PROPS
onTabbarHide? : (...args: any[]) => void
onTabbarShow? : (...args: any[]) => void
ref?: React.MutableRefObject<{el: HTMLElement | null; hide: () => void; show: () => void;}>;
CHILDREN_PROP
*/
var TabBar = /*#__PURE__*/forwardRef(function (props, ref) {
var elRef = useRef(null);
var onTabbarHide = props.onTabbarHide,
onTabbarShow = props.onTabbarShow,
className = props.className,
fill = props.fill;
useImperativeHandle(ref, function () {
return elRef.current;
});
var classes = classNames(className, {
'toolbar-fill': fill
});
return /*#__PURE__*/React.createElement(Toolbar, _extends({
onToolbarHide: onTabbarHide,
onToolbarShow: onTabbarShow,
tabbar: true,
className: classes
}, props, {
ref: elRef
}), props.children);
});
TabBar.displayName = 'zmp-toolbar';
export default TabBar;