Tweak haptics, add to post controls (#5977)

* change timing to 10ms, make ios only

* add haptics to post controls

* rm from like button
This commit is contained in:
Samuel Newman
2024-10-28 22:03:08 +02:00
committed by GitHub
parent dcc5405e8a
commit d050a78a2d
4 changed files with 23 additions and 11 deletions
+10 -6
View File
@@ -10,8 +10,8 @@ import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {clamp} from '#/lib/numbers'
import {gradients} from '#/lib/styles'
import {isWeb} from '#/platform/detection'
import {native} from '#/alf'
import {isIOS, isWeb} from '#/platform/detection'
import {ios} from '#/alf'
export interface FABProps
extends ComponentProps<typeof TouchableWithoutFeedback> {
@@ -41,14 +41,18 @@ export function FABInner({testID, icon, onPress, ...props}: FABProps) {
]}>
<PressableScale
testID={testID}
onPressIn={() => playHaptic('Light')}
onPressIn={ios(() => playHaptic('Light'))}
onPress={evt => {
onPress?.(evt)
setTimeout(() => playHaptic('Medium'), 200)
if (isIOS) {
setTimeout(() => playHaptic('Medium'), 10)
} else {
playHaptic('Light')
}
}}
onLongPress={native((evt: any) => {
onLongPress={ios((evt: any) => {
onPress?.(evt)
setTimeout(() => playHaptic('Heavy'), 200)
playHaptic('Heavy')
})}
targetScale={0.9}
{...props}>
@@ -250,6 +250,7 @@ let PostCtrls = ({
style={btnStyle}
onPress={() => {
if (!post.viewer?.replyDisabled) {
playHaptic('Light')
requireAuth(() => onPressReply())
}
}}
@@ -51,9 +51,11 @@ let RepostButton = ({
<Button
testID="repostBtn"
onPress={() => {
playHaptic('Light')
requireAuth(() => dialogControl.open())
}}
onLongPress={() => {
playHaptic('Heavy')
requireAuth(() => onQuote())
}}
style={[