Improve Android haptic, offer toggle for haptics in the app (#3482)

* improve android haptics, offer toggle for haptics

* update haptics.ts

* default to false

* simplify to `playHaptic`

* just leave them as `feedInfo`

* use a hook for `playHaptic`

* missed one of them
This commit is contained in:
Hailey 2024-04-11 15:20:26 -07:00 committed by GitHub
parent 9007810cdb
commit 740cd029d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 235 additions and 204 deletions

View file

@ -8,7 +8,7 @@ import {BottomTabBarProps} from '@react-navigation/bottom-tabs'
import {StackActions} from '@react-navigation/native'
import {useAnalytics} from '#/lib/analytics/analytics'
import {Haptics} from '#/lib/haptics'
import {useHaptics} from '#/lib/haptics'
import {useDedupe} from '#/lib/hooks/useDedupe'
import {useMinimalShellMode} from '#/lib/hooks/useMinimalShellMode'
import {useNavigationTabState} from '#/lib/hooks/useNavigationTabState'
@ -59,6 +59,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const closeAllActiveElements = useCloseAllActiveElements()
const dedupe = useDedupe()
const accountSwitchControl = useDialogControl()
const playHaptic = useHaptics()
const showSignIn = React.useCallback(() => {
closeAllActiveElements()
@ -104,9 +105,9 @@ export function BottomBar({navigation}: BottomTabBarProps) {
}, [onPressTab])
const onLongPressProfile = React.useCallback(() => {
Haptics.default()
playHaptic()
accountSwitchControl.open()
}, [accountSwitchControl])
}, [accountSwitchControl, playHaptic])
return (
<>