Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(suite-native): welcome flow ui review fixes #16868

Merged
merged 1 commit into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState } from 'react';
import { TouchableOpacity } from 'react-native';

import { EventType, analytics } from '@suite-native/analytics';
import { Box, Button, Card, Switch, Text, TitleHeader, VStack } from '@suite-native/atoms';
Expand Down Expand Up @@ -57,6 +58,10 @@ export const AnalyticsConsentScreen = ({
handleOpenLink(LEARN_MORE_LINK);
};

const toggleAnalyticsConsent = () => {
setIsEnabled(prevIsEnabled => !prevIsEnabled);
};

return (
<Screen>
<VStack justifyContent="space-between" flex={1}>
Expand Down Expand Up @@ -92,23 +97,26 @@ export const AnalyticsConsentScreen = ({
}
/>
</VStack>
<Box
flexDirection="row"
alignItems="center"
justifyContent="space-between"
style={applyStyle(consentWrapperStyle)}
<TouchableOpacity
onPress={toggleAnalyticsConsent}
activeOpacity={0.5}
>
<Text>
<Translation id="moduleOnboarding.analyticsConsentScreen.helpSwitchTitle" />
</Text>
<Switch
testID="@onboarding/AnalyticsConsent/consentSwitch"
isChecked={isEnabled}
onChange={enabled => {
setIsEnabled(enabled);
}}
/>
</Box>
<Box
flexDirection="row"
Comment on lines +104 to +105
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using VStack here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VStack does not make sense here because the flexDirection="row". Did you mean HStack? Anyway, I don't see any benefit of using Stack component here. Why would you like to use is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, HStack is what I meant. And I believe it makes sense since you don't have to specify direction explicitly.

alignItems="center"
justifyContent="space-between"
style={applyStyle(consentWrapperStyle)}
>
<Text>
<Translation id="moduleOnboarding.analyticsConsentScreen.helpSwitchTitle" />
</Text>
<Switch
testID="@onboarding/AnalyticsConsent/consentSwitch"
isChecked={isEnabled}
onChange={toggleAnalyticsConsent}
/>
</Box>
</TouchableOpacity>
</VStack>
</Box>
</Card>
Expand Down
13 changes: 10 additions & 3 deletions suite-native/module-onboarding/src/screens/BiometricsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@ import {
StackProps,
} from '@suite-native/navigation';
import { setIsOnboardingFinished } from '@suite-native/settings';
import { prepareNativeStyle, useNativeStyles } from '@trezor/styles';

const titleStyle = prepareNativeStyle(_ => ({
// this title should have smaller letter spacing by design.
letterSpacing: -1.4,
}));

export const BiometricsScreen = ({
navigation,
}: StackProps<OnboardingStackParamList, OnboardingStackRoutes.Biometrics>) => {
const { applyStyle } = useNativeStyles();
const { toggleBiometricsOption } = useBiometricsSettings();

const dispatch = useDispatch();
Expand Down Expand Up @@ -68,10 +75,10 @@ export const BiometricsScreen = ({
return (
<Screen header={<ScreenHeader />}>
<VStack justifyContent="space-between" flex={1}>
<Box flex={1} alignItems="center" paddingTop="sp32">
<Box flex={1} alignItems="center" justifyContent="center">
<BiometricsSvg />
</Box>
<VStack spacing={40}>
<VStack spacing="sp40">
<VStack spacing="sp16">
<HStack spacing="sp8" alignItems="center">
<Icon
Expand All @@ -83,7 +90,7 @@ export const BiometricsScreen = ({
<Translation id="moduleOnboarding.biometricsScreen.title" />
</Text>
</HStack>
<Text variant="titleMedium">
<Text style={applyStyle(titleStyle)} variant="titleMedium">
<Translation id="moduleOnboarding.biometricsScreen.description" />
</Text>
</VStack>
Expand Down
Loading