Merge pull request #4079 from BlueWallet/tooltip

DEL: Package
This commit is contained in:
GLaDOS 2021-10-21 12:39:54 +01:00 committed by GitHub
commit cdea09dfca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 7 deletions

View File

@ -0,0 +1,32 @@
// @ts-ignore: Ignore
import type { Element } from 'react';
import { Text, TouchableNativeFeedback, TouchableWithoutFeedback, View, findNodeHandle, UIManager } from 'react-native';
type PopupMenuItem = { id?: any; label: string };
type OnPopupMenuItemSelect = (selectedPopupMenuItem: PopupMenuItem) => void;
type PopupAnchor = Element<typeof Text | typeof TouchableNativeFeedback | typeof TouchableWithoutFeedback | typeof View>;
type PopupMenuOptions = { onCancel?: () => void };
function showPopupMenu(
items: PopupMenuItem[],
onSelect: OnPopupMenuItemSelect,
anchor: PopupAnchor,
{ onCancel }: PopupMenuOptions = {},
): void {
UIManager.showPopupMenu(
// @ts-ignore: Ignore
findNodeHandle(anchor),
items.map(item => item.label),
function () {
if (onCancel) onCancel();
},
function (eventName: 'dismissed' | 'itemSelected', selectedIndex?: number) {
// @ts-ignore: Ignore
if (eventName === 'itemSelected') onSelect(items[selectedIndex]);
else onCancel && onCancel();
},
);
}
export type { PopupMenuItem, OnPopupMenuItemSelect, PopupMenuOptions };
export default showPopupMenu;

View File

@ -1,7 +1,7 @@
import React, { useRef, cloneElement, useEffect, forwardRef } from 'react';
import PropTypes from 'prop-types';
import showPopupMenu from 'react-native-popup-menu-android';
import { Pressable, TouchableOpacity } from 'react-native';
import showPopupMenu from '../blue_modules/showPopupMenu';
const ToolTipMenu = (props, ref) => {
const menuRef = useRef();

5
package-lock.json generated
View File

@ -19874,11 +19874,6 @@
"version": "git+https://github.com/BlueWallet/react-native-passcode-auth.git#a2ff977ba92b36f8d0a5567f59c05cc608e8bd12",
"from": "git+https://github.com/BlueWallet/react-native-passcode-auth.git#a2ff977ba92b36f8d0a5567f59c05cc608e8bd12"
},
"react-native-popup-menu-android": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/react-native-popup-menu-android/-/react-native-popup-menu-android-1.0.3.tgz",
"integrity": "sha512-DzEU0Ejl/kMZz6FJ7Mks8se4jceJZk9QINHILNU9GQFrjP4mxodZ9HiqVbs9F+xUE4NCOE8Ib36MxxdfLRw1OQ=="
},
"react-native-privacy-snapshot": {
"version": "git+https://github.com/BlueWallet/react-native-privacy-snapshot.git#529e4627d93f67752a27e82a040ff7b64dca0783",
"from": "git+https://github.com/BlueWallet/react-native-privacy-snapshot.git#529e4627d93f67752a27e82a040ff7b64dca0783"

View File

@ -165,7 +165,6 @@
"react-native-navigation-bar-color": "https://github.com/BlueWallet/react-native-navigation-bar-color#3b2894ae62fbce99a3bd24105f0921cebaef5c94",
"react-native-obscure": "https://github.com/BlueWallet/react-native-obscure.git#f4b83b4a261e39b1f5ed4a45ac5bcabc8a59eadb",
"react-native-passcode-auth": "https://github.com/BlueWallet/react-native-passcode-auth#a2ff977ba92b36f8d0a5567f59c05cc608e8bd12",
"react-native-popup-menu-android": "1.0.3",
"react-native-privacy-snapshot": "https://github.com/BlueWallet/react-native-privacy-snapshot#529e4627d93f67752a27e82a040ff7b64dca0783",
"react-native-prompt-android": "https://github.com/BlueWallet/react-native-prompt-android#ed168d66fed556bc2ed07cf498770f058b78a376",
"react-native-push-notification": "5.1.1",