Skip to content

Commit

Permalink
fix: hold to reveal UI/UX (#10607)
Browse files Browse the repository at this point in the history
Fixes the UI/UX related to "Hold to reveal"
  • Loading branch information
gantunesr authored Aug 13, 2024
1 parent 0ba2cbf commit a42d97f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions app/components/UI/ButtonReveal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react';
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome5';
import Icon, {
IconSize,
IconName,
} from '../../../component-library/components/Icons/Icon';
import { fontStyles } from '../../../styles/common';
import Svg, { Circle } from 'react-native-svg';
import Animated, {
Expand All @@ -19,7 +22,6 @@ const AnimatedCircle = Animated.createAnimatedComponent(Circle);

const radius = 14;
const strokeWidth = 2;
const iconSize = radius - 4;
const innerRadius = radius - strokeWidth / 2;
const circumference = 2 * Math.PI * innerRadius;
const animationDuration = 1200;
Expand Down Expand Up @@ -219,7 +221,6 @@ const ButtonReveal = ({ onLongPress, label }: Props) => {

const lockIconStyle = useAnimatedStyle(() => ({
opacity: pressControl.value,
// transform: [{ scale: pressControl.value }],
}));

const checkIconStyle = useAnimatedStyle(() => ({
Expand Down Expand Up @@ -255,9 +256,9 @@ const ButtonReveal = ({ onLongPress, label }: Props) => {
</Animated.View>
<Animated.View style={[styles.absoluteFillWithCenter, checkIconStyle]}>
<Icon
name={'check'}
name={IconName.Check}
color={colors.primary.inverse}
size={iconSize * 1.5}
size={IconSize.Lg}
/>
</Animated.View>
</View>
Expand All @@ -267,9 +268,6 @@ const ButtonReveal = ({ onLongPress, label }: Props) => {
<Animated.View
style={[styles.preCompletedContainerStyle, preCompletedContainerStyle]}
>
<Animated.View style={[styles.absoluteFillWithCenter, lockIconStyle]}>
<Icon name={'lock'} color={colors.primary.inverse} size={iconSize} />
</Animated.View>
<Svg style={styles.absoluteFill}>
<Circle
cx={radius}
Expand All @@ -278,6 +276,7 @@ const ButtonReveal = ({ onLongPress, label }: Props) => {
stroke={colors.primary.alternative}
strokeWidth={strokeWidth}
strokeLinecap={'round'}
fill={colors.primary.inverse}
/>
</Svg>
<Svg style={[styles.absoluteFill, styles.animatedCircle]}>
Expand All @@ -286,12 +285,20 @@ const ButtonReveal = ({ onLongPress, label }: Props) => {
cx={radius}
cy={radius}
r={innerRadius}
stroke={colors.primary.inverse}
stroke={colors.primary.alternative}
strokeWidth={strokeWidth}
strokeLinecap={'round'}
strokeDasharray={`${circumference} ${circumference}`}
fill={colors.primary.inverse}
/>
</Svg>
<Animated.View style={[styles.absoluteFillWithCenter, lockIconStyle]}>
<Icon
name={IconName.Lock}
color={colors.primary.default}
size={IconSize.Sm}
/>
</Animated.View>
</Animated.View>
);

Expand Down

0 comments on commit a42d97f

Please sign in to comment.