This commit is contained in:
marcosrdz 2021-02-25 01:46:04 -05:00
parent 2c6c43a664
commit e1b7967e57
4 changed files with 15 additions and 33 deletions

View File

@ -301,14 +301,6 @@ export class BlueWalletNavigationHeader extends Component {
this.tooltip.current.showMenu(); this.tooltip.current.showMenu();
}; };
handleToolTipOnPress = item => {
if (item === 'copyToClipboard') {
this.handleCopyPress();
} else if (item === 'walletBalanceVisibility') {
this.handleBalanceVisibility();
}
};
render() { render() {
const balance = const balance =
!this.state.wallet.hideBalance && !this.state.wallet.hideBalance &&
@ -374,7 +366,6 @@ export class BlueWalletNavigationHeader extends Component {
}, },
] ]
} }
onPress={this.handleToolTipOnPress}
/> />
<TouchableOpacity <TouchableOpacity
style={styles.balance} style={styles.balance}
@ -1456,7 +1447,8 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
if (subtitleNumberOfLines === 1) { if (subtitleNumberOfLines === 1) {
setSubtitleNumberOfLines(0); setSubtitleNumberOfLines(0);
} }
}, [subtitleNumberOfLines]); // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const subtitleProps = useMemo(() => ({ numberOfLines: subtitleNumberOfLines }), [subtitleNumberOfLines]); const subtitleProps = useMemo(() => ({ numberOfLines: subtitleNumberOfLines }), [subtitleNumberOfLines]);
@ -1480,35 +1472,27 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
}); });
} }
if (subtitle) { if (subtitle) {
actions.push( actions.push({
{ id: 'copyNote',
id: 'copyNote', text: loc.transactions.copy_note,
text: loc.transactions.copy_note, onPress: handleOnCopyNote,
onPress: handleOnCopyNote, });
}, if (subtitleNumberOfLines === 1) {
{ actions.push({
id: 'expandNote', id: 'expandNote',
text: loc.transactions.expand_note, text: loc.transactions.expand_note,
onPress: handleOnExpandNote, onPress: handleOnExpandNote,
}, });
); }
} }
return actions; return actions;
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [item.hash, subtitle, rowTitle]); }, [item.hash, subtitle, rowTitle, subtitleNumberOfLines, txMetadata]);
const handleOnToolTipActionPress = useCallback(
id => {
const action = toolTipActions.find(action => action.id === id);
action.onPress();
},
[toolTipActions],
);
return ( return (
<TouchableWithoutFeedback ref={listItemRef}> <TouchableWithoutFeedback ref={listItemRef}>
<View style={{ marginHorizontal: 4 }}> <View style={{ marginHorizontal: 4 }}>
<ToolTipMenu ref={toolTip} anchorRef={listItemRef} actions={toolTipActions} onPress={handleOnToolTipActionPress} /> <ToolTipMenu ref={toolTip} anchorRef={listItemRef} actions={toolTipActions} />
<BlueListItem <BlueListItem
leftAvatar={avatar} leftAvatar={avatar}
title={title} title={title}

View File

@ -5,7 +5,8 @@ import showPopupMenu from 'react-native-popup-menu-android';
const ToolTipMenu = (props, ref) => { const ToolTipMenu = (props, ref) => {
const handleToolTipSelection = selection => { const handleToolTipSelection = selection => {
props.onPress(selection.id); const action = props.actions.find(action => action.id === selection.id);
action.onPress();
}; };
const showMenu = () => { const showMenu = () => {
@ -25,5 +26,4 @@ export default forwardRef(ToolTipMenu);
ToolTipMenu.propTypes = { ToolTipMenu.propTypes = {
actions: PropTypes.arrayOf(PropTypes.shape).isRequired, actions: PropTypes.arrayOf(PropTypes.shape).isRequired,
anchorRef: PropTypes.node, anchorRef: PropTypes.node,
onPress: PropTypes.func.isRequired,
}; };

View File

@ -171,7 +171,6 @@ const ReceiveDetails = () => {
onPress: handleShareQRCode, onPress: handleShareQRCode,
}, },
]} ]}
onPress={handleShareQRCode}
/> />
<QRCode <QRCode

View File

@ -204,7 +204,6 @@ const TransactionsDetails = () => {
onPress: handleCopyPress, onPress: handleCopyPress,
}, },
]} ]}
onPress={handleCopyPress}
/> />
<TouchableOpacity <TouchableOpacity
ref={openTransactionOnBlockExplorerRef} ref={openTransactionOnBlockExplorerRef}