diff --git a/src/__tests__/scenes/__snapshots__/CryptoExchangeQuoteScene.test.tsx.snap b/src/__tests__/scenes/__snapshots__/CryptoExchangeQuoteScene.test.tsx.snap index 927d0056549..0e4291ee5e9 100644 --- a/src/__tests__/scenes/__snapshots__/CryptoExchangeQuoteScene.test.tsx.snap +++ b/src/__tests__/scenes/__snapshots__/CryptoExchangeQuoteScene.test.tsx.snap @@ -1780,14 +1780,27 @@ exports[`CryptoExchangeQuoteScreenComponent should render with loading props 1`] , , ] `; diff --git a/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap b/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap index a284fdf7801..38eb99a1fd3 100644 --- a/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap +++ b/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap @@ -1310,22 +1310,35 @@ exports[`SendScene2 1 spendTarget 1`] = ` , , ] `; @@ -2828,22 +2841,35 @@ exports[`SendScene2 1 spendTarget with info tiles 1`] = ` , , ] `; @@ -4323,22 +4349,35 @@ exports[`SendScene2 2 spendTargets 1`] = ` , , ] `; @@ -5519,22 +5558,35 @@ exports[`SendScene2 2 spendTargets hide tiles 1`] = ` , , ] `; @@ -6691,22 +6743,35 @@ exports[`SendScene2 2 spendTargets hide tiles 2`] = ` , , ] `; @@ -7702,22 +7767,35 @@ exports[`SendScene2 2 spendTargets hide tiles 3`] = ` , , ] `; @@ -9018,22 +9096,35 @@ exports[`SendScene2 2 spendTargets lock tiles 1`] = ` , , ] `; @@ -10269,22 +10360,35 @@ exports[`SendScene2 2 spendTargets lock tiles 2`] = ` , , ] `; @@ -11479,22 +11583,35 @@ exports[`SendScene2 2 spendTargets lock tiles 3`] = ` , , ] `; @@ -12674,22 +12791,35 @@ exports[`SendScene2 Render SendScene 1`] = ` , , ] `; diff --git a/src/__tests__/scenes/__snapshots__/TransactionDetailsScene.test.tsx.snap b/src/__tests__/scenes/__snapshots__/TransactionDetailsScene.test.tsx.snap index d22290f6d00..a7ba591b9e3 100644 --- a/src/__tests__/scenes/__snapshots__/TransactionDetailsScene.test.tsx.snap +++ b/src/__tests__/scenes/__snapshots__/TransactionDetailsScene.test.tsx.snap @@ -1838,14 +1838,27 @@ exports[`TransactionDetailsScene should render 1`] = ` , , ] `; @@ -3688,14 +3701,27 @@ exports[`TransactionDetailsScene should render with negative nativeAmount and fi , , ] `; diff --git a/src/components/common/SceneWrapper.tsx b/src/components/common/SceneWrapper.tsx index 32196c5bd35..c7c0ef25f5d 100644 --- a/src/components/common/SceneWrapper.tsx +++ b/src/components/common/SceneWrapper.tsx @@ -192,34 +192,32 @@ export function SceneWrapper(props: SceneWrapperProps): JSX.Element { const info: SceneWrapperInfo = { insets, insetStyle, undoInsetStyle, hasTabs, isKeyboardOpen } return ( - - - {}} - // Fixes middle-floating scrollbar issue - scrollIndicatorInsets={{ right: 1 }} - > - - {isFuncChildren ? children(info) : children} - - - {renderFooter != null || hasNotifications ? ( - <> - {hasNotifications ? : null} - {renderFooter != null && !hasTabs ? {renderFooter(info)} : null} - - ) : null} - + <> + + + {}} + // Fixes middle-floating scrollbar issue + scrollIndicatorInsets={{ right: 1 }} + > + + {isFuncChildren ? children(info) : children} + + + {renderFooter != null && !hasTabs ? {renderFooter(info)} : null} + + {hasNotifications ? : null} + ) } diff --git a/src/components/notification/NotificationCard.tsx b/src/components/notification/NotificationCard.tsx index dfb65c2f6c1..fbd8d89220b 100644 --- a/src/components/notification/NotificationCard.tsx +++ b/src/components/notification/NotificationCard.tsx @@ -109,7 +109,7 @@ const getStyles = cacheStyles((theme: Theme) => ({ flexDirection: 'row', justifyContent: 'center', padding: theme.rem(0.5), - margin: theme.rem(0.25) + margin: theme.rem(0.5) } })) diff --git a/src/components/notification/NotificationView.tsx b/src/components/notification/NotificationView.tsx index 3fa234771e1..a7e57ba6189 100644 --- a/src/components/notification/NotificationView.tsx +++ b/src/components/notification/NotificationView.tsx @@ -1,23 +1,28 @@ import * as React from 'react' -import { View } from 'react-native' +import Animated, { interpolate, SharedValue, useAnimatedStyle } from 'react-native-reanimated' +import { useSafeAreaInsets } from 'react-native-safe-area-context' import { sprintf } from 'sprintf-js' import { showBackupModal } from '../../actions/BackupModalActions' import { useHandler } from '../../hooks/useHandler' import { useWatch } from '../../hooks/useWatch' import { lstrings } from '../../locales/strings' +import { useSceneFooterState } from '../../state/SceneFooterState' import { useDispatch, useSelector } from '../../types/reactRedux' import { NavigationBase } from '../../types/routerTypes' import { styled } from '../hoc/styled' import { useTheme } from '../services/ThemeContext' +import { MAX_TAB_BAR_HEIGHT, MIN_TAB_BAR_HEIGHT } from '../themed/MenuTabs' import { NotificationCard } from './NotificationCard' interface Props { navigation: NavigationBase + + hasTabs: boolean } const NotificationViewComponent = (props: Props) => { - const { navigation } = props + const { navigation, hasTabs } = props const theme = useTheme() const dispatch = useDispatch() @@ -27,6 +32,9 @@ const NotificationViewComponent = (props: Props) => { const isBackupWarningShown = account.id != null && account.username == null + const { bottom: insetBottom } = useSafeAreaInsets() + const { footerOpenRatio, footerHeight = 0 } = useSceneFooterState() + const [autoDetectTokenCards, setAutoDetectTokenCards] = React.useState([]) const handlePress = useHandler(async () => { @@ -78,7 +86,7 @@ const NotificationViewComponent = (props: Props) => { }, [detectedTokensRedux, handlePress, theme]) return ( - + {isBackupWarningShown ? ( ) : null} @@ -87,14 +95,25 @@ const NotificationViewComponent = (props: Props) => { ) } -const NotificationCardsContainer = styled(View)(theme => ({ - // Outer layout - marginHorizontal: theme.rem(0.5), - marginVertical: theme.rem(0.5), - // Inner layout - alignSelf: 'center', - justifyContent: 'flex-end' -})) +const NotificationCardsContainer = styled(Animated.View)<{ hasTabs: boolean; insetBottom: number; footerHeight: number; footerOpenRatio: SharedValue }>( + theme => + ({ hasTabs, insetBottom, footerHeight, footerOpenRatio }) => { + return [ + { + position: 'absolute', + padding: theme.rem(0.5), + alignSelf: 'center', + justifyContent: 'flex-end' + }, + useAnimatedStyle(() => { + const menuBarHeight = hasTabs ? interpolate(footerOpenRatio.value, [0, 1], [MIN_TAB_BAR_HEIGHT, MAX_TAB_BAR_HEIGHT]) : 0 + return { + bottom: menuBarHeight + footerOpenRatio.value * footerHeight + insetBottom + } + }) + ] + } +) /** * Manages which notification cards are shown in a persistent app-wide view.