mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-20 02:09:10 +01:00
35 lines
794 B
JavaScript
35 lines
794 B
JavaScript
import React, { useRef, forwardRef, useEffect } from 'react';
|
|
import ToolTip from 'react-native-tooltip';
|
|
import PropTypes from 'prop-types';
|
|
import { View } from 'react-native';
|
|
|
|
const ToolTipMenu = (props, ref) => {
|
|
const toolTip = useRef();
|
|
|
|
const showMenu = () => {
|
|
console.log('Showing ToolTip');
|
|
toolTip.current?.showMenu();
|
|
};
|
|
|
|
const hideMenu = () => {
|
|
console.log('Hiding ToolTip');
|
|
toolTip.current?.hideMenu();
|
|
};
|
|
|
|
useEffect(() => {
|
|
ref.current.showMenu = showMenu;
|
|
ref.current.hideMenu = hideMenu;
|
|
}, [ref]);
|
|
|
|
return (
|
|
<View ref={ref}>
|
|
<ToolTip ref={toolTip} actions={props.actions} />
|
|
</View>
|
|
);
|
|
};
|
|
|
|
export default forwardRef(ToolTipMenu);
|
|
ToolTipMenu.propTypes = {
|
|
actions: PropTypes.arrayOf(PropTypes.shape).isRequired,
|
|
};
|