Readd hitslop to post controls (#1461)

* Readd hitslop to post controls

* Bigger hitslop on bigger controls
zio/stable
Paul Frazee 2023-09-15 14:01:44 -07:00 committed by GitHub
parent e3de91788e
commit 763a50692f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import {useTheme} from 'lib/ThemeContext'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {RepostButton} from './RepostButton' import {RepostButton} from './RepostButton'
import {Haptics} from 'lib/haptics' import {Haptics} from 'lib/haptics'
import {HITSLOP_10, HITSLOP_20} from 'lib/constants'
interface PostCtrlsOpts { interface PostCtrlsOpts {
itemUri: string itemUri: string
@ -106,7 +107,8 @@ export function PostCtrls(opts: PostCtrlsOpts) {
accessibilityLabel={`Reply (${opts.replyCount} ${ accessibilityLabel={`Reply (${opts.replyCount} ${
opts.replyCount === 1 ? 'reply' : 'replies' opts.replyCount === 1 ? 'reply' : 'replies'
})`} })`}
accessibilityHint="reply composer"> accessibilityHint=""
hitSlop={opts.big ? HITSLOP_20 : HITSLOP_10}>
<CommentBottomArrow <CommentBottomArrow
style={[defaultCtrlColor, opts.big ? s.mt2 : styles.mt1]} style={[defaultCtrlColor, opts.big ? s.mt2 : styles.mt1]}
strokeWidth={3} strokeWidth={3}
@ -127,7 +129,8 @@ export function PostCtrls(opts: PostCtrlsOpts) {
accessibilityLabel={`${opts.isLiked ? 'Unlike' : 'Like'} (${ accessibilityLabel={`${opts.isLiked ? 'Unlike' : 'Like'} (${
opts.likeCount opts.likeCount
} ${pluralize(opts.likeCount || 0, 'like')})`} } ${pluralize(opts.likeCount || 0, 'like')})`}
accessibilityHint=""> accessibilityHint=""
hitSlop={opts.big ? HITSLOP_20 : HITSLOP_10}>
{opts.isLiked ? ( {opts.isLiked ? (
<HeartIconSolid <HeartIconSolid
style={styles.ctrlIconLiked} style={styles.ctrlIconLiked}

View File

@ -6,6 +6,7 @@ import {useTheme} from 'lib/ThemeContext'
import {Text} from '../text/Text' import {Text} from '../text/Text'
import {pluralize} from 'lib/strings/helpers' import {pluralize} from 'lib/strings/helpers'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {HITSLOP_10, HITSLOP_20} from 'lib/constants'
interface Props { interface Props {
isReposted: boolean isReposted: boolean
@ -50,7 +51,8 @@ export const RepostButton = ({
accessibilityLabel={`${ accessibilityLabel={`${
isReposted ? 'Undo repost' : 'Repost' isReposted ? 'Undo repost' : 'Repost'
} (${repostCount} ${pluralize(repostCount || 0, 'repost')})`} } (${repostCount} ${pluralize(repostCount || 0, 'repost')})`}
accessibilityHint=""> accessibilityHint=""
hitSlop={big ? HITSLOP_20 : HITSLOP_10}>
<RepostIcon <RepostIcon
style={ style={
isReposted isReposted