Skip to content

Commit

Permalink
chore(mobile): experimental onPressIn haptic feedback (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkdev98 committed Jul 17, 2024
1 parent abf5dc4 commit 0ce0a73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions apps/mobile/components/numeric-pad/numeric-pad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ export function NumericPad({
return
}

Haptics.selectionAsync()

onValueChange?.(newValue)
}

function handleDelete() {
Haptics.selectionAsync()
const newValue = Math.floor(value / 10)
onValueChange?.(newValue)
}
Expand All @@ -71,6 +68,7 @@ export function NumericPad({
onPress={() => handleKeyPress(buttonKey)}
variant="ghost"
size="lg"
onPressIn={Haptics.selectionAsync}
>
<Text className="!text-2xl">{buttonKey}</Text>
</Button>
Expand All @@ -83,6 +81,7 @@ export function NumericPad({
onLongPress={handleClear}
variant="secondary"
size="lg"
onPressIn={Haptics.selectionAsync}
>
<DeleteIcon className="size-8 text-primary" />
</Button>
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/components/transaction/transaction-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import { zodResolver } from '@hookform/resolvers/zod'
import { t } from '@lingui/macro'
import { useLingui } from '@lingui/react'
import * as Haptics from 'expo-haptics'
import { LandPlot, Trash2Icon, XIcon } from 'lucide-react-native'
import { Controller, FormProvider, useForm } from 'react-hook-form'
import { ScrollView, View } from 'react-native'
Expand Down Expand Up @@ -119,6 +120,7 @@ export const TransactionForm = ({
</View>
<SubmitButton
onPress={transactionForm.handleSubmit(onSubmit)}
onPressIn={Haptics.selectionAsync}
disabled={transactionForm.formState.isLoading || !amount}
>
<Text>{t(i18n)`Save`}</Text>
Expand Down

0 comments on commit 0ce0a73

Please sign in to comment.