@@ -37,7 +37,7 @@ import { Title } from '../../../styles/text';
3737import NavigationHeader from '../../../components/NavigationHeader' ;
3838import useColors from '../../../hooks/colors' ;
3939import { useAppDispatch , useAppSelector } from '../../../hooks/redux' ;
40- import { useBalance , useSwitchUnit } from '../../../hooks/wallet' ;
40+ import { useBalance , useSwitchUnitAnnounced } from '../../../hooks/wallet' ;
4141import ActivityList from '../../Activity/ActivityList' ;
4242import BitcoinBreakdown from './BitcoinBreakdown' ;
4343import SafeAreaInset from '../../../components/SafeAreaInset' ;
@@ -51,6 +51,10 @@ import {
5151import { capitalize } from '../../../utils/helpers' ;
5252import DetectSwipe from '../../../components/DetectSwipe' ;
5353import type { WalletScreenProps } from '../../../navigation/types' ;
54+ import { showToast } from '../../../utils/notifications' ;
55+ import { useTranslation } from 'react-i18next' ;
56+ import { ignoresHideBalanceToastSelector } from '../../../store/reselect/user' ;
57+ import { ignoreHideBalanceToast } from '../../../store/slices/user' ;
5458
5559const updateHeight = ( { height, toValue = 0 , duration = 250 } ) : void => {
5660 try {
@@ -94,14 +98,18 @@ const WalletsDetail = ({
9498 enableSwipeToHideBalanceSelector ,
9599 ) ;
96100 const hideBalance = useAppSelector ( hideBalanceSelector ) ;
97- const [ _ , switchUnit ] = useSwitchUnit ( ) ;
101+ const ignoresHideBalanceToast = useAppSelector (
102+ ignoresHideBalanceToastSelector ,
103+ ) ;
104+ const onSwitchUnit = useSwitchUnitAnnounced ( ) ;
98105 const colors = useColors ( ) ;
99106 const size = useSharedValue ( { width : 0 , height : 0 } ) ;
100107 const title = capitalize ( assetType ) ;
101108 const [ showDetails , setShowDetails ] = useState ( true ) ;
102109 const [ radiusContainerHeight , setRadiusContainerHeight ] = useState ( 400 ) ;
103110 const [ headerHeight , setHeaderHeight ] = useState ( 0 ) ;
104111 const height = useSharedValue ( 0 ) ;
112+ const { t } = useTranslation ( 'wallet' ) ;
105113
106114 const activityPadding = useMemo (
107115 ( ) => ( { paddingTop : radiusContainerHeight , paddingBottom : 230 } ) ,
@@ -113,7 +121,16 @@ const WalletsDetail = ({
113121 } , [ height , headerHeight ] ) ;
114122
115123 const toggleHideBalance = ( ) : void => {
116- dispatch ( updateSettings ( { hideBalance : ! hideBalance } ) ) ;
124+ const enabled = ! hideBalance ;
125+ dispatch ( updateSettings ( { hideBalance : enabled } ) ) ;
126+ if ( ! ignoresHideBalanceToast && enabled ) {
127+ showToast ( {
128+ type : 'info' ,
129+ title : t ( 'balance_hidden_title' ) ,
130+ description : t ( 'balance_hidden_message' ) ,
131+ } ) ;
132+ dispatch ( ignoreHideBalanceToast ( ) ) ;
133+ }
117134 } ;
118135
119136 const onScroll = useCallback (
@@ -200,7 +217,7 @@ const WalletsDetail = ({
200217 style = { styles . cell }
201218 entering = { FadeIn }
202219 exiting = { FadeOut } >
203- < TouchableOpacity onPress = { switchUnit } >
220+ < TouchableOpacity onPress = { onSwitchUnit } >
204221 < Money
205222 sats = { totalBalance }
206223 enableHide = { true }
@@ -223,7 +240,7 @@ const WalletsDetail = ({
223240 onSwipeLeft = { toggleHideBalance }
224241 onSwipeRight = { toggleHideBalance } >
225242 < TouchableOpacity
226- onPress = { switchUnit }
243+ onPress = { onSwitchUnit }
227244 style = { styles . largeValueContainer } >
228245 < Money
229246 sats = { totalBalance }
0 commit comments