From 3f80a9824201bee0a82ad808c858fb1205ba9233 Mon Sep 17 00:00:00 2001 From: mvaivre Date: Sat, 2 Nov 2024 12:23:20 +0100 Subject: [PATCH] Stop using progress header in Send flow, add gradient to BottomButtons Goal: reduce visual load to the max --- .../src/components/buttons/BottomButtons.tsx | 36 ++++- .../src/components/headers/BaseHeader.tsx | 2 +- .../src/components/layout/ScrollScreen.tsx | 6 +- .../send/screens/DestinationScreen.tsx | 152 ++++++++++-------- .../src/navigation/SendNavigation.tsx | 1 - 5 files changed, 120 insertions(+), 77 deletions(-) diff --git a/apps/mobile-wallet/src/components/buttons/BottomButtons.tsx b/apps/mobile-wallet/src/components/buttons/BottomButtons.tsx index 2eeeb67d4..dd38eee61 100644 --- a/apps/mobile-wallet/src/components/buttons/BottomButtons.tsx +++ b/apps/mobile-wallet/src/components/buttons/BottomButtons.tsx @@ -15,18 +15,43 @@ GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the library. If not, see . */ +import { colord } from 'colord' +import { LinearGradient } from 'expo-linear-gradient' import { ReactNode } from 'react' import { StyleProp, ViewStyle } from 'react-native' -import styled from 'styled-components/native' +import { useSafeAreaInsets } from 'react-native-safe-area-context' +import styled, { useTheme } from 'styled-components/native' import { DEFAULT_MARGIN, VERTICAL_GAP } from '~/style/globalStyle' interface BottomButtonsProps { children: ReactNode + bottomInset?: boolean style?: StyleProp } -const BottomButtons = ({ children, style }: BottomButtonsProps) => {children} +const BottomButtons = ({ children, bottomInset, style }: BottomButtonsProps) => { + const theme = useTheme() + const insets = useSafeAreaInsets() + + return ( + + + {children} + + ) +} export default BottomButtons @@ -36,3 +61,10 @@ const Container = styled.View` margin: ${VERTICAL_GAP * 2}px ${DEFAULT_MARGIN}px ${VERTICAL_GAP}px; gap: 20px; ` + +const Gradient = styled(LinearGradient)` + position: absolute; + bottom: 0; + left: 0; + right: 0; +` diff --git a/apps/mobile-wallet/src/components/headers/BaseHeader.tsx b/apps/mobile-wallet/src/components/headers/BaseHeader.tsx index 0c3146031..163b29d49 100644 --- a/apps/mobile-wallet/src/components/headers/BaseHeader.tsx +++ b/apps/mobile-wallet/src/components/headers/BaseHeader.tsx @@ -89,7 +89,7 @@ const BaseHeader = ({ Extrapolation.CLAMP ) } - : {} + : { opacity: 1 } ) const handleHeaderLayout = (e: LayoutChangeEvent) => { diff --git a/apps/mobile-wallet/src/components/layout/ScrollScreen.tsx b/apps/mobile-wallet/src/components/layout/ScrollScreen.tsx index 97facdf77..057c944c5 100644 --- a/apps/mobile-wallet/src/components/layout/ScrollScreen.tsx +++ b/apps/mobile-wallet/src/components/layout/ScrollScreen.tsx @@ -44,7 +44,7 @@ export interface ScrollScreenBaseProps extends ScreenProps { fill?: boolean screenTitle?: string screenIntro?: string - screenTitleAlwaysVisible?: boolean + headerTitleAlwaysVisible?: boolean floatingHeader?: boolean headerScrollEffectOffset?: number TitleSideComponent?: ReactNode @@ -69,7 +69,7 @@ const ScrollScreen = ({ headerOptions, screenTitle, screenIntro, - screenTitleAlwaysVisible, + headerTitleAlwaysVisible, floatingHeader, headerScrollEffectOffset, TitleSideComponent, @@ -99,7 +99,7 @@ const ScrollScreen = ({ options={{ headerTitle: screenTitle, ...headerOptions }} scrollY={screenScrollY} scrollEffectOffset={headerScrollEffectOffset} - titleAlwaysVisible={screenTitleAlwaysVisible} + titleAlwaysVisible={headerTitleAlwaysVisible} style={floatingHeader ? { position: 'absolute', top: 0, left: 0, right: 0 } : undefined} /> )} diff --git a/apps/mobile-wallet/src/features/send/screens/DestinationScreen.tsx b/apps/mobile-wallet/src/features/send/screens/DestinationScreen.tsx index 4ec965d00..5893f4618 100644 --- a/apps/mobile-wallet/src/features/send/screens/DestinationScreen.tsx +++ b/apps/mobile-wallet/src/features/send/screens/DestinationScreen.tsx @@ -29,6 +29,7 @@ import styled, { useTheme } from 'styled-components/native' import { sendAnalytics } from '~/analytics' import { defaultSpringConfiguration } from '~/animations/reanimated/reanimatedAnimations' +import BottomButtons from '~/components/buttons/BottomButtons' import Button, { CloseButton, ContinueButton } from '~/components/buttons/Button' import Input from '~/components/inputs/Input' import { ScreenProps, ScreenSection } from '~/components/layout/Screen' @@ -176,78 +177,89 @@ const DestinationScreen = ({ navigation, route: { params }, ...props }: Destinat })) return ( - - - ( - - )} - rules={{ - required: true, - validate: validateIsAddressValid - }} - control={control} - /> - - - -