Fix post controls tap areas (#2627)

This commit is contained in:
dan 2024-01-25 22:06:28 +00:00 committed by GitHub
parent ef84f3a25e
commit 10b1d16c8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 87 additions and 67 deletions

View file

@ -118,14 +118,14 @@ let PostCtrls = ({
return ( return (
<View style={[styles.ctrls, style]}> <View style={[styles.ctrls, style]}>
<TouchableOpacity <View
testID="replyBtn"
style={[ style={[
styles.ctrl, styles.ctrl,
!big && styles.ctrlPad,
{paddingLeft: 0},
post.viewer?.replyDisabled ? {opacity: 0.5} : undefined, post.viewer?.replyDisabled ? {opacity: 0.5} : undefined,
]} ]}>
<TouchableOpacity
testID="replyBtn"
style={[styles.btn, !big && styles.btnPad, {paddingLeft: 0}]}
onPress={() => { onPress={() => {
if (!post.viewer?.replyDisabled) { if (!post.viewer?.replyDisabled) {
requireAuth(() => onPressReply()) requireAuth(() => onPressReply())
@ -148,7 +148,8 @@ let PostCtrls = ({
</Text> </Text>
) : undefined} ) : undefined}
</TouchableOpacity> </TouchableOpacity>
<View style={[styles.ctrl, !big && styles.ctrlPad]}> </View>
<View style={[styles.ctrl]}>
<RepostButton <RepostButton
big={big} big={big}
isReposted={!!post.viewer?.repost} isReposted={!!post.viewer?.repost}
@ -157,9 +158,10 @@ let PostCtrls = ({
onQuote={onQuote} onQuote={onQuote}
/> />
</View> </View>
<View style={styles.ctrl}>
<TouchableOpacity <TouchableOpacity
testID="likeBtn" testID="likeBtn"
style={[styles.ctrl, !big && styles.ctrlPad]} style={[styles.btn, !big && styles.btnPad]}
onPress={() => { onPress={() => {
requireAuth(() => onPressToggleLike()) requireAuth(() => onPressToggleLike())
}} }}
@ -190,6 +192,7 @@ let PostCtrls = ({
</Text> </Text>
) : undefined} ) : undefined}
</TouchableOpacity> </TouchableOpacity>
</View>
{big ? undefined : ( {big ? undefined : (
<PostDropdownBtn <PostDropdownBtn
testID="postDropdownBtn" testID="postDropdownBtn"
@ -199,7 +202,7 @@ let PostCtrls = ({
record={record} record={record}
richText={richText} richText={richText}
showAppealLabelItem={showAppealLabelItem} showAppealLabelItem={showAppealLabelItem}
style={styles.ctrlPad} style={styles.btnPad}
/> />
)} )}
{/* used for adding pad to the right side */} {/* used for adding pad to the right side */}
@ -214,13 +217,17 @@ const styles = StyleSheet.create({
ctrls: { ctrls: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center',
}, },
ctrl: { ctrl: {
flex: 1, flex: 1,
alignItems: 'flex-start',
},
btn: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
}, },
ctrlPad: { btnPad: {
paddingTop: 5, paddingTop: 5,
paddingBottom: 5, paddingBottom: 5,
paddingLeft: 5, paddingLeft: 5,

View file

@ -53,7 +53,7 @@ let RepostButton = ({
onPress={() => { onPress={() => {
requireAuth(() => onPressToggleRepostWrapper()) requireAuth(() => onPressToggleRepostWrapper())
}} }}
style={[styles.container]} style={[styles.btn, !big && styles.btnPad]}
accessibilityRole="button" accessibilityRole="button"
accessibilityLabel={`${ accessibilityLabel={`${
isReposted isReposted
@ -89,10 +89,16 @@ RepostButton = memo(RepostButton)
export {RepostButton} export {RepostButton}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { btn: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
}, },
btnPad: {
paddingTop: 5,
paddingBottom: 5,
paddingLeft: 5,
paddingRight: 5,
},
reposted: { reposted: {
color: colors.green3, color: colors.green3,
}, },

View file

@ -69,7 +69,8 @@ export const RepostButton = ({
const inner = ( const inner = (
<View <View
style={[ style={[
styles.container, styles.btn,
!big && styles.btnPad,
(isReposted (isReposted
? styles.reposted ? styles.reposted
: defaultControlColor) as StyleProp<ViewStyle>, : defaultControlColor) as StyleProp<ViewStyle>,
@ -109,11 +110,17 @@ export const RepostButton = ({
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { btn: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
gap: 4, gap: 4,
}, },
btnPad: {
paddingTop: 5,
paddingBottom: 5,
paddingLeft: 5,
paddingRight: 5,
},
reposted: { reposted: {
color: colors.green3, color: colors.green3,
}, },