From 10b1d16c8af8bdbcd2b7dfb546074f36654e7612 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 25 Jan 2024 22:06:28 +0000 Subject: Fix post controls tap areas (#2627) --- src/view/com/util/post-ctrls/PostCtrls.tsx | 133 ++++++++++++---------- src/view/com/util/post-ctrls/RepostButton.tsx | 10 +- src/view/com/util/post-ctrls/RepostButton.web.tsx | 11 +- 3 files changed, 87 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/view/com/util/post-ctrls/PostCtrls.tsx b/src/view/com/util/post-ctrls/PostCtrls.tsx index 65582ba88..a6d7e38c3 100644 --- a/src/view/com/util/post-ctrls/PostCtrls.tsx +++ b/src/view/com/util/post-ctrls/PostCtrls.tsx @@ -118,37 +118,38 @@ let PostCtrls = ({ return ( - { - if (!post.viewer?.replyDisabled) { - requireAuth(() => onPressReply()) - } - }} - accessibilityRole="button" - accessibilityLabel={`Reply (${post.replyCount} ${ - post.replyCount === 1 ? 'reply' : 'replies' - })`} - accessibilityHint="" - hitSlop={big ? HITSLOP_20 : HITSLOP_10}> - - {typeof post.replyCount !== 'undefined' && post.replyCount > 0 ? ( - - {post.replyCount} - - ) : undefined} - - + ]}> + { + if (!post.viewer?.replyDisabled) { + requireAuth(() => onPressReply()) + } + }} + accessibilityRole="button" + accessibilityLabel={`Reply (${post.replyCount} ${ + post.replyCount === 1 ? 'reply' : 'replies' + })`} + accessibilityHint="" + hitSlop={big ? HITSLOP_20 : HITSLOP_10}> + + {typeof post.replyCount !== 'undefined' && post.replyCount > 0 ? ( + + {post.replyCount} + + ) : undefined} + + + - { - requireAuth(() => onPressToggleLike()) - }} - accessibilityRole="button" - accessibilityLabel={`${ - post.viewer?.like ? _(msg`Unlike`) : _(msg`Like`) - } (${post.likeCount} ${pluralize(post.likeCount || 0, 'like')})`} - accessibilityHint="" - hitSlop={big ? HITSLOP_20 : HITSLOP_10}> - {post.viewer?.like ? ( - - ) : ( - - )} - {typeof post.likeCount !== 'undefined' && post.likeCount > 0 ? ( - - {post.likeCount} - - ) : undefined} - + + { + requireAuth(() => onPressToggleLike()) + }} + accessibilityRole="button" + accessibilityLabel={`${ + post.viewer?.like ? _(msg`Unlike`) : _(msg`Like`) + } (${post.likeCount} ${pluralize(post.likeCount || 0, 'like')})`} + accessibilityHint="" + hitSlop={big ? HITSLOP_20 : HITSLOP_10}> + {post.viewer?.like ? ( + + ) : ( + + )} + {typeof post.likeCount !== 'undefined' && post.likeCount > 0 ? ( + + {post.likeCount} + + ) : undefined} + + {big ? undefined : ( )} {/* used for adding pad to the right side */} @@ -214,13 +217,17 @@ const styles = StyleSheet.create({ ctrls: { flexDirection: 'row', justifyContent: 'space-between', + alignItems: 'center', }, ctrl: { flex: 1, + alignItems: 'flex-start', + }, + btn: { flexDirection: 'row', alignItems: 'center', }, - ctrlPad: { + btnPad: { paddingTop: 5, paddingBottom: 5, paddingLeft: 5, diff --git a/src/view/com/util/post-ctrls/RepostButton.tsx b/src/view/com/util/post-ctrls/RepostButton.tsx index 8e70534dc..cc3db50c8 100644 --- a/src/view/com/util/post-ctrls/RepostButton.tsx +++ b/src/view/com/util/post-ctrls/RepostButton.tsx @@ -53,7 +53,7 @@ let RepostButton = ({ onPress={() => { requireAuth(() => onPressToggleRepostWrapper()) }} - style={[styles.container]} + style={[styles.btn, !big && styles.btnPad]} accessibilityRole="button" accessibilityLabel={`${ isReposted @@ -89,10 +89,16 @@ RepostButton = memo(RepostButton) export {RepostButton} const styles = StyleSheet.create({ - container: { + btn: { flexDirection: 'row', alignItems: 'center', }, + btnPad: { + paddingTop: 5, + paddingBottom: 5, + paddingLeft: 5, + paddingRight: 5, + }, reposted: { color: colors.green3, }, diff --git a/src/view/com/util/post-ctrls/RepostButton.web.tsx b/src/view/com/util/post-ctrls/RepostButton.web.tsx index a888178a3..bbe5869fe 100644 --- a/src/view/com/util/post-ctrls/RepostButton.web.tsx +++ b/src/view/com/util/post-ctrls/RepostButton.web.tsx @@ -69,7 +69,8 @@ export const RepostButton = ({ const inner = ( , @@ -109,11 +110,17 @@ export const RepostButton = ({ } const styles = StyleSheet.create({ - container: { + btn: { flexDirection: 'row', alignItems: 'center', gap: 4, }, + btnPad: { + paddingTop: 5, + paddingBottom: 5, + paddingLeft: 5, + paddingRight: 5, + }, reposted: { color: colors.green3, }, -- cgit 1.4.1