mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
FIX: Some android devices where unable to process onPress
This commit is contained in:
parent
cdea09dfca
commit
7a8a7ae8cb
@ -1,6 +1,6 @@
|
||||
import React, { useRef, cloneElement, useEffect, forwardRef } from 'react';
|
||||
import React, { useRef, useEffect, forwardRef } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Pressable, TouchableOpacity } from 'react-native';
|
||||
import { TouchableOpacity } from 'react-native';
|
||||
import showPopupMenu from '../blue_modules/showPopupMenu';
|
||||
|
||||
const ToolTipMenu = (props, ref) => {
|
||||
@ -38,14 +38,14 @@ const ToolTipMenu = (props, ref) => {
|
||||
};
|
||||
|
||||
const child = (Array.isArray(props.children) ? props.children[0] : props.children) || null;
|
||||
return isMenuPrimaryAction ? (
|
||||
<TouchableOpacity style={buttonStyle} ref={menuRef} onPress={showMenu}>
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={buttonStyle}
|
||||
ref={menuRef}
|
||||
{...(isMenuPrimaryAction ? { onPress: showMenu } : { onPress: props.onPress, onLongPress: showMenu })}
|
||||
>
|
||||
{child}
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
<Pressable ref={menuRef} onLongPress={showMenu}>
|
||||
{child && cloneElement(child, { onLongPress: showMenu })}
|
||||
</Pressable>
|
||||
);
|
||||
};
|
||||
|
||||
@ -55,4 +55,5 @@ ToolTipMenu.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
onPressMenuItem: PropTypes.func.isRequired,
|
||||
isMenuPrimaryAction: PropTypes.bool,
|
||||
onPress: PropTypes.func,
|
||||
};
|
||||
|
@ -2,6 +2,7 @@ import React, { forwardRef } from 'react';
|
||||
import { ContextMenuView, ContextMenuButton } from 'react-native-ios-context-menu';
|
||||
import PropTypes from 'prop-types';
|
||||
import QRCodeComponent from './QRCodeComponent';
|
||||
import { TouchableOpacity } from 'react-native-gesture-handler';
|
||||
|
||||
const ToolTipMenu = (props, ref) => {
|
||||
const menuItemMapped = ({ action, menuOptions }) => {
|
||||
@ -56,7 +57,7 @@ const ToolTipMenu = (props, ref) => {
|
||||
}}
|
||||
style={buttonStyle}
|
||||
>
|
||||
{props.children}
|
||||
{props.onPress ? <TouchableOpacity onPress={props.onPress}>{props.children}</TouchableOpacity> : props.children}
|
||||
</ContextMenuButton>
|
||||
) : (
|
||||
<ContextMenuView
|
||||
@ -78,7 +79,7 @@ const ToolTipMenu = (props, ref) => {
|
||||
}
|
||||
: {})}
|
||||
>
|
||||
{props.children}
|
||||
{props.onPress ? <TouchableOpacity onPress={props.onPress}>{props.children}</TouchableOpacity> : props.children}
|
||||
</ContextMenuView>
|
||||
);
|
||||
};
|
||||
@ -92,5 +93,6 @@ ToolTipMenu.propTypes = {
|
||||
isMenuPrimaryAction: PropTypes.bool,
|
||||
isButton: PropTypes.bool,
|
||||
previewQRCode: PropTypes.bool,
|
||||
onPress: PropTypes.func,
|
||||
previewValue: PropTypes.string,
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* eslint react/prop-types: "off" */
|
||||
import React, { useState, useMemo, useCallback, useContext, useEffect, useRef } from 'react';
|
||||
import { Linking, StyleSheet, TouchableOpacity, View } from 'react-native';
|
||||
import { Linking, StyleSheet, View } from 'react-native';
|
||||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
import * as NavigationService from '../NavigationService';
|
||||
@ -324,16 +324,14 @@ export const TransactionListItem = React.memo(({ item, itemPriceUnit = BitcoinUn
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<ToolTipMenu ref={menuRef} actions={toolTipActions} onPressMenuItem={onToolTipPress}>
|
||||
<ToolTipMenu ref={menuRef} actions={toolTipActions} onPressMenuItem={onToolTipPress} onPress={onPress}>
|
||||
<BlueListItem
|
||||
leftAvatar={avatar}
|
||||
title={title}
|
||||
subtitleNumberOfLines={subtitleNumberOfLines}
|
||||
subtitle={subtitle}
|
||||
subtitleProps={subtitleProps}
|
||||
onPress={onPress}
|
||||
chevron={false}
|
||||
Component={TouchableOpacity}
|
||||
rightTitle={rowTitle}
|
||||
rightTitleStyle={rowTitleStyle}
|
||||
containerStyle={containerStyle}
|
||||
|
@ -209,6 +209,7 @@ export default class TransactionsNavigationHeader extends Component {
|
||||
{this.state.wallet.getLabel()}
|
||||
</Text>
|
||||
<ToolTipMenu
|
||||
onPress={this.changeWalletBalanceUnit}
|
||||
ref={this.menuRef}
|
||||
title={loc.wallets.balance}
|
||||
onPressMenuItem={this.onPressMenuItem}
|
||||
@ -235,7 +236,7 @@ export default class TransactionsNavigationHeader extends Component {
|
||||
]
|
||||
}
|
||||
>
|
||||
<TouchableOpacity accessibilityRole="button" style={styles.balance} onPress={this.changeWalletBalanceUnit}>
|
||||
<View style={styles.balance}>
|
||||
{this.state.wallet.hideBalance ? (
|
||||
<BluePrivateBalance />
|
||||
) : (
|
||||
@ -249,13 +250,13 @@ export default class TransactionsNavigationHeader extends Component {
|
||||
{balance}
|
||||
</Text>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</ToolTipMenu>
|
||||
{this.state.wallet.type === LightningCustodianWallet.type && this.state.allowOnchainAddress && (
|
||||
<ToolTipMenu
|
||||
isMenuPrimaryAction
|
||||
isButton
|
||||
onPressMenuItem={this.manageFundsPressed}
|
||||
onPress={this.manageFundsPressed}
|
||||
actions={this.toolTipMenuActions}
|
||||
buttonStyle={styles.manageFundsButton}
|
||||
>
|
||||
|
@ -112,8 +112,9 @@ const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }) =>
|
||||
onPressMenuItem={onToolTipPress}
|
||||
previewQRCode
|
||||
previewValue={item.address}
|
||||
onPress={navigateToReceive}
|
||||
>
|
||||
<ListItem key={`${item.key}`} button onPress={navigateToReceive} containerStyle={stylesHook.container}>
|
||||
<ListItem key={`${item.key}`} containerStyle={stylesHook.container}>
|
||||
<ListItem.Content style={stylesHook.list}>
|
||||
<ListItem.Title style={stylesHook.list} numberOfLines={1} ellipsizeMode="middle">
|
||||
<Text style={[styles.index, stylesHook.index]}>{item.index + 1}</Text>{' '}
|
||||
|
@ -220,14 +220,11 @@ const TransactionsDetails = () => {
|
||||
},
|
||||
]}
|
||||
onPressMenuItem={handleCopyPress}
|
||||
onPress={handleOnOpenTransactionOnBlockExporerTapped}
|
||||
>
|
||||
<TouchableOpacity
|
||||
accessibilityRole="button"
|
||||
onPress={handleOnOpenTransactionOnBlockExporerTapped}
|
||||
style={[styles.greyButton, stylesHooks.greyButton]}
|
||||
>
|
||||
<View style={[styles.greyButton, stylesHooks.greyButton]}>
|
||||
<Text style={[styles.Link, stylesHooks.Link]}>{loc.transactions.details_show_in_block_explorer}</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</ToolTipMenu>
|
||||
</BlueCard>
|
||||
</ScrollView>
|
||||
|
Loading…
Reference in New Issue
Block a user