From b8be7c84fcf5a699892875193be29c61481e05d9 Mon Sep 17 00:00:00 2001 From: Michael Demarais Date: Fri, 24 Apr 2020 22:24:25 -0400 Subject: [PATCH] Fix incorrect SavingsPredictionStepper values for non-stablecoins Fixes RAI-503 https://linear.app/issue/RAI-503/savings-prediction-stepper-values-are-incorrect --- src/screens/SavingsSheet.js | 54 +++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/screens/SavingsSheet.js b/src/screens/SavingsSheet.js index 20001a60c3d..fb477894e41 100644 --- a/src/screens/SavingsSheet.js +++ b/src/screens/SavingsSheet.js @@ -1,5 +1,5 @@ import analytics from '@segment/analytics-react-native'; -import React, { Fragment, useCallback, useEffect } from 'react'; +import React, { Fragment, useCallback, useEffect, useMemo } from 'react'; import { useNavigation } from 'react-navigation-hooks'; import Divider from '../components/Divider'; import { SavingsCoinRow } from '../components/coin-row'; @@ -14,10 +14,21 @@ import { SavingsSheetHeader, } from '../components/savings'; import { Sheet, SheetActionButton } from '../components/sheet'; +import { isSymbolStablecoin } from '../helpers/savings'; import { convertAmountToNativeDisplay } from '../helpers/utilities'; import { useAccountSettings } from '../hooks'; import { colors, padding } from '../styles'; +const DepositButtonShadows = [ + [0, 7, 21, colors.dark, 0.25], + [0, 3.5, 10.5, colors.swapPurple, 0.35], +]; + +const WithdrawButtonShadows = [ + [0, 7, 21, colors.dark, 0.25], + [0, 3.5, 10.5, colors.dark, 0.35], +]; + const SavingsSheet = () => { const { getParam, navigate } = useNavigation(); const { nativeCurrency, nativeCurrencySymbol } = useAccountSettings(); @@ -41,6 +52,23 @@ const SavingsSheet = () => { nativeCurrency ); + const savingsRowItem = useMemo( + () => ({ + lifetimeSupplyInterestAccrued, + name: underlying.name, + supplyBalanceUnderlying, + supplyRate, + symbol: underlying.symbol, + }), + [ + lifetimeSupplyInterestAccrued, + supplyBalanceUnderlying, + supplyRate, + underlying.name, + underlying.symbol, + ] + ); + useEffect(() => { return () => { analytics.track('Closed Savings Sheet', { @@ -102,19 +130,13 @@ const SavingsSheet = () => { color={colors.dark} label="􀁏 Withdraw" onPress={onWithdraw} - shadows={[ - [0, 7, 21, colors.dark, 0.25], - [0, 3.5, 10.5, colors.dark, 0.35], - ]} + shadows={WithdrawButtonShadows} /> @@ -132,13 +154,7 @@ const SavingsSheet = () => { @@ -148,7 +164,11 @@ const SavingsSheet = () => {