play haptics before closing modal (#4283)

This commit is contained in:
Samuel Newman 2024-05-30 15:46:26 +03:00 committed by GitHub
parent b077cbe399
commit 16925baf8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 12 deletions

View file

@ -3,6 +3,7 @@ import {View} from 'react-native'
import {msg, plural} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useHaptics} from '#/lib/haptics'
import {useRequireAuth} from '#/state/session'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
@ -30,6 +31,7 @@ let RepostButton = ({
const {_} = useLingui()
const requireAuth = useRequireAuth()
const dialogControl = Dialog.useDialogControl()
const playHaptic = useHaptics()
const color = React.useMemo(
() => ({
@ -89,8 +91,11 @@ let RepostButton = ({
: _(msg({message: `Repost`, context: 'action'}))
}
onPress={() => {
dialogControl.close()
onRepost()
if (!isReposted) playHaptic()
dialogControl.close(() => {
onRepost()
})
}}
size="large"
variant="ghost"
@ -106,6 +111,7 @@ let RepostButton = ({
style={[a.justify_start, a.px_md]}
label={_(msg`Quote post`)}
onPress={() => {
playHaptic()
dialogControl.close(() => {
onQuote()
})