Skip to content

Commit

Permalink
fix: lifecycle and accessibility improvements (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
janrtvld authored Nov 25, 2024
1 parent 160ae6d commit 3119fa2
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
8 changes: 7 additions & 1 deletion apps/easypid/src/features/menu/FunkeMenuScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ export function FunkeMenuScreen() {
))}
<YStack py="$4" ai="center">
<YStack px="$4" w="60%">
<Button.Solid scaleOnPress onPress={onResetWallet}>
<Button.Solid
accessible={true}
accessibilityRole="button"
aria-label="Reset wallet"
scaleOnPress
onPress={onResetWallet}
>
Reset wallet
</Button.Solid>
</YStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface OnboardingBiometricsProps {

export function OnboardingBiometrics({ goToNextStep, actionText }: OnboardingBiometricsProps) {
const [isLoading, setIsLoading] = useState(false)
const { height, onLayout } = useImageScaler()
const { height, onLayout } = useImageScaler({ scaleFactor: 0.6 })

const onEnableBiometrics = () => {
if (isLoading) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function OnboardingIdCardScan({
showScanModal,
onStartScanning,
}: OnboardingIdCardScanProps) {
const { height, onLayout } = useImageScaler()
const { height, onLayout } = useImageScaler({ scaleFactor: 0.6 })

return (
<>
Expand Down
9 changes: 8 additions & 1 deletion apps/easypid/src/features/wallet/FunkeWalletScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ export function FunkeWalletScreen() {
}}
>
<YStack fg={1}>
<Stack accessible={true} alignItems="center" pt="$6" pb="$4">
<Stack
accessible={true}
aria-label="Scan QR-Code"
accessibilityRole="button"
alignItems="center"
pt="$6"
pb="$4"
>
<AnimatedStack
flexDirection="column"
style={qrPressStyle}
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/src/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ export function getCredentialForDisplay(
): CredentialForDisplay {
const credentialCategoryMetadata = getCredentialCategoryMetadata(credentialRecord)
const credentialForDisplayId = getCredentialForDisplayId(credentialRecord)
const hasRefreshToken = getRefreshCredentialMetadata(credentialRecord) !== undefined
const hasRefreshToken = getRefreshCredentialMetadata(credentialRecord) !== null

if (credentialRecord instanceof SdJwtVcRecord) {
const sdJwtVc = credentialRecord.credential
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/CardInfoLifecycle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, HeroIcons, InfoButton, InfoSheet, Stack, useToastController } from '@package/ui'
import { Button, HeroIcons, InfoButton, InfoSheet, Stack } from '@package/ui'
import type { StatusVariant } from '@package/ui/src/utils/variants'
import { formatDate, formatDaysString, getDaysUntil } from '@package/utils/src'
import { useRouter } from 'expo-router'
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/hooks/useImageScaler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import type { LayoutChangeEvent } from 'react-native'

const SCALE_FACTOR = 0.7

export function useImageScaler() {
export function useImageScaler({ scaleFactor = SCALE_FACTOR }: { scaleFactor?: number } = {}) {
const [availableImageHeight, setAvailableImageHeight] = useState(0)

return {
height: availableImageHeight * SCALE_FACTOR,
height: availableImageHeight * scaleFactor,
onLayout: (event: LayoutChangeEvent) => {
if (availableImageHeight === 0) {
setAvailableImageHeight(event.nativeEvent.layout.height)
Expand Down

0 comments on commit 3119fa2

Please sign in to comment.