mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
Merge pull request #6611 from BlueWallet/tooltipfix
FIX: Tooltip was in ocassions missing styles
This commit is contained in:
commit
034ddb1ac2
4 changed files with 43 additions and 26 deletions
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Image, Keyboard, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { Image, Keyboard, StyleSheet, Text, TextInput, View } from 'react-native';
|
||||
|
||||
import { scanQrHelper } from '../helpers/scan-qr';
|
||||
import loc from '../loc';
|
||||
import { useTheme } from './themes';
|
||||
|
@ -134,17 +135,17 @@ const AddressInput = ({
|
|||
keyboardType={keyboardType}
|
||||
/>
|
||||
{editable ? (
|
||||
<ToolTipMenu actions={actions} isButton onPressMenuItem={onMenuItemPressed}>
|
||||
<TouchableOpacity
|
||||
<ToolTipMenu
|
||||
actions={actions}
|
||||
isButton
|
||||
onPressMenuItem={onMenuItemPressed}
|
||||
testID="BlueAddressInputScanQrButton"
|
||||
disabled={isLoading}
|
||||
onPress={async () => {
|
||||
await scanButtonTapped();
|
||||
Keyboard.dismiss();
|
||||
// @ts-ignore: Fix later
|
||||
scanQrHelper(launchedBy).then(onBarScanned);
|
||||
if (launchedBy) scanQrHelper(launchedBy).then(value => onBarScanned({ data: value }));
|
||||
}}
|
||||
accessibilityRole="button"
|
||||
style={[styles.scan, stylesHook.scan]}
|
||||
accessibilityLabel={loc.send.details_scan}
|
||||
accessibilityHint={loc.send.details_scan_hint}
|
||||
|
@ -153,7 +154,6 @@ const AddressInput = ({
|
|||
<Text style={[styles.scanText, stylesHook.scanText]} accessible={false}>
|
||||
{loc.send.details_scan}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</ToolTipMenu>
|
||||
) : null}
|
||||
</View>
|
||||
|
|
|
@ -44,8 +44,15 @@ const menuActions: Action[] =
|
|||
text: loc.transactions.details_copy,
|
||||
icon: actionIcons.Copy,
|
||||
},
|
||||
{ id: actionKeys.Share, text: loc.receive.details_share, icon: actionIcons.Share },
|
||||
]
|
||||
: [{ id: actionKeys.Share, text: loc.receive.details_share, icon: actionIcons.Share }];
|
||||
: [
|
||||
{
|
||||
id: actionKeys.Copy,
|
||||
text: loc.transactions.details_copy,
|
||||
icon: actionIcons.Copy,
|
||||
},
|
||||
];
|
||||
|
||||
const QRCodeComponent: React.FC<QRCodeComponentProps> = ({
|
||||
value = '',
|
||||
|
|
|
@ -16,6 +16,7 @@ const BaseToolTipMenu = (props: ToolTipMenuProps, ref: Ref<any>) => {
|
|||
onMenuWillHide,
|
||||
buttonStyle,
|
||||
onPressMenuItem,
|
||||
...restProps
|
||||
} = props;
|
||||
|
||||
const menuItemMapped = useCallback(({ action, menuOptions }: { action: Action; menuOptions?: string[] }) => {
|
||||
|
@ -70,8 +71,12 @@ const BaseToolTipMenu = (props: ToolTipMenuProps, ref: Ref<any>) => {
|
|||
menuTitle: title,
|
||||
menuItems,
|
||||
}}
|
||||
{...restProps}
|
||||
style={buttonStyle}
|
||||
>
|
||||
<TouchableOpacity onPress={onPress} disabled={disabled} accessibilityRole="button" {...restProps}>
|
||||
{props.children}
|
||||
</TouchableOpacity>
|
||||
</ContextMenuButton>
|
||||
);
|
||||
|
||||
|
@ -98,7 +103,7 @@ const BaseToolTipMenu = (props: ToolTipMenuProps, ref: Ref<any>) => {
|
|||
: {})}
|
||||
>
|
||||
{onPress ? (
|
||||
<TouchableOpacity accessibilityRole="button" onPress={onPress}>
|
||||
<TouchableOpacity accessibilityRole="button" onPress={onPress} {...restProps}>
|
||||
{props.children}
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
|
@ -108,7 +113,7 @@ const BaseToolTipMenu = (props: ToolTipMenuProps, ref: Ref<any>) => {
|
|||
);
|
||||
|
||||
return isMenuPrimaryAction && onPress ? (
|
||||
<TouchableOpacity onPress={onPress} disabled={disabled} accessibilityRole="button" style={buttonStyle}>
|
||||
<TouchableOpacity onPress={onPress} disabled={disabled} accessibilityRole="button" {...restProps}>
|
||||
{renderContextMenuButton()}
|
||||
</TouchableOpacity>
|
||||
) : isButton ? (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ViewStyle } from 'react-native';
|
||||
import { AccessibilityRole, ViewStyle } from 'react-native';
|
||||
|
||||
export interface Action {
|
||||
id: string | number;
|
||||
|
@ -23,7 +23,12 @@ export interface ToolTipMenuProps {
|
|||
renderPreview?: () => React.ReactNode;
|
||||
onPress?: () => void;
|
||||
previewValue?: string;
|
||||
accessibilityRole?: AccessibilityRole;
|
||||
disabled?: boolean;
|
||||
testID?: string;
|
||||
style?: ViewStyle | ViewStyle[];
|
||||
accessibilityLabel?: string;
|
||||
accessibilityHint?: string;
|
||||
buttonStyle?: ViewStyle;
|
||||
onMenuWillShow?: () => void;
|
||||
onMenuWillHide?: () => void;
|
||||
|
|
Loading…
Add table
Reference in a new issue