Merge pull request #2719 from BlueWallet/tooltip

FIX: Remove whitespace and minus character when copying amount
This commit is contained in:
GLaDOS 2021-02-27 16:29:11 +00:00 committed by GitHub
commit d928e39181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/* eslint react/prop-types: "off", react-native/no-inline-styles: "off" */
import React, { Component, useState, useMemo, useCallback, useContext, useRef } from 'react';
import React, { Component, useState, useMemo, useCallback, useContext, useRef, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Icon, Input, Text, Header, ListItem, Avatar } from 'react-native-elements';
import {
@ -616,7 +616,7 @@ export const BlueListItem = React.memo(props => {
</ListItem.Title>
{props.subtitle && (
<ListItem.Subtitle
numberOfLines={1}
numberOfLines={props.subtitleNumberOfLines ?? 1}
style={{ flexWrap: 'wrap', color: colors.alternativeTextColor, fontWeight: '400', fontSize: 14 }}
>
{props.subtitle}
@ -1392,6 +1392,10 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
}
}, [item]);
useEffect(() => {
setSubtitleNumberOfLines(1);
}, [subtitle]);
const onPress = useCallback(async () => {
if (item.hash) {
navigate('TransactionStatus', { hash: item.hash });
@ -1442,18 +1446,16 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
}, []);
const handleOnExpandNote = useCallback(() => {
if (subtitleNumberOfLines === 1) {
setSubtitleNumberOfLines(0);
}
setSubtitleNumberOfLines(0);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [subtitle]);
const subtitleProps = useMemo(() => ({ numberOfLines: subtitleNumberOfLines }), [subtitleNumberOfLines]);
const handleOnCopyTap = useCallback(() => {
toolTip.current.hideMenu();
setTimeout(copyToolTip.current.showMenu, 400);
setTimeout(copyToolTip.current.showMenu, 205);
}, []);
const handleOnCopyAmountTap = useCallback(() => Clipboard.setString(rowTitle), [rowTitle]);
const handleOnCopyAmountTap = useCallback(() => Clipboard.setString(rowTitle.replace(/[\s\\-]/g, '')), [rowTitle]);
const handleOnCopyTransactionID = useCallback(() => Clipboard.setString(item.hash), [item.hash]);
const handleOnCopyNote = useCallback(() => Clipboard.setString(subtitle), [subtitle]);
const handleOnViewOnBlockExplorer = useCallback(() => {
@ -1536,7 +1538,7 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
<BlueListItem
leftAvatar={avatar}
title={title}
titleNumberOfLines={subtitleNumberOfLines}
subtitleNumberOfLines={subtitleNumberOfLines}
subtitle={subtitle}
subtitleProps={subtitleProps}
onPress={onPress}

View File

@ -267,9 +267,9 @@ PODS:
- React-Core
- react-native-is-catalyst (1.0.0):
- React
- react-native-randombytes (3.5.3):
- React
- react-native-safe-area-context (3.1.8):
- react-native-randombytes (3.6.0):
- React-Core
- react-native-safe-area-context (3.1.9):
- React-Core
- react-native-slider (3.0.3):
- React
@ -359,8 +359,8 @@ PODS:
- React-Core
- RNFS (2.16.6):
- React
- RNGestureHandler (1.8.0):
- React
- RNGestureHandler (1.9.0):
- React-Core
- RNHandoff (0.0.3):
- React
- RNInAppBrowser (3.5.1):
@ -375,8 +375,8 @@ PODS:
- React
- RNReactNativeHapticFeedback (1.11.0):
- React-Core
- RNReanimated (1.13.1):
- React
- RNReanimated (1.13.2):
- React-Core
- RNScreens (2.17.1):
- React-Core
- RNSecureKeyStore (1.0.0):
@ -703,8 +703,8 @@ SPEC CHECKSUMS:
react-native-idle-timer: 97b8283237d45146a7a5c25bdebe9e1e85f3687b
react-native-image-picker: 248afb60a0c5a24153cb7c7483b257f30541323b
react-native-is-catalyst: 52ee70e0123c82419dd4ce47dc4cc94b22467512
react-native-randombytes: 991545e6eaaf700b4ee384c291ef3d572e0b2ca8
react-native-safe-area-context: 01158a92c300895d79dee447e980672dc3fb85a6
react-native-randombytes: 45ae693012df24c9a07a5e578b3b567c01468581
react-native-safe-area-context: 86612d2c9a9e94e288319262d10b5f93f0b395f5
react-native-slider: b733e17fdd31186707146debf1f04b5d94aa1a93
react-native-tcp-socket: 96a4f104cdcc9c6621aafe92937f163d88447c5b
react-native-webview: c010115ea45efd0d329ac7746d0cc59579d7860c
@ -728,7 +728,7 @@ SPEC CHECKSUMS:
RNDefaultPreference: 21816c0a6f61a2829ccc0cef034392e9b509ee5f
RNDeviceInfo: 54401b60514387f9120ab8265be5ed9103d842b9
RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df
RNGestureHandler: 7a5833d0f788dbd107fbb913e09aa0c1ff333c39
RNGestureHandler: 9b7e605a741412e20e13c512738a31bd1611759b
RNHandoff: d3b0754cca3a6bcd9b25f544f733f7f033ccf5fa
RNInAppBrowser: 3733c1aa6699983a1c9b4963e85d5e5a48ad297e
RNLocalize: dcf0fdb332b37b0d24178e876a7ce4dbbc9c838d
@ -736,7 +736,7 @@ SPEC CHECKSUMS:
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
RNRate: 2b31dad120cd1b78e33c6034808561c386a3dddf
RNReactNativeHapticFeedback: 653a8c126a0f5e88ce15ffe280b3ff37e1fbb285
RNReanimated: dd8c286ab5dd4ba36d3a7fef8bff7e08711b5476
RNReanimated: e03f7425cb7a38dcf1b644d680d1bfc91c3337ad
RNScreens: b6c9607e6fe47c1b6e2f1910d2acd46dd7ecea3a
RNSecureKeyStore: f1ad870e53806453039f650720d2845c678d89c8
RNSentry: 1adaa43b01c6a3ab5091d4d1add66b7c58558898