play haptics before closing modal (#4283)
This commit is contained in:
parent
b077cbe399
commit
16925baf8d
2 changed files with 8 additions and 12 deletions
|
@ -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()
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue