From b14cf939d23cd8fa9c309bc24ce34e63225b4772 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 1 Feb 2023 18:20:02 -0600 Subject: [PATCH] Disable like/repost animations to see if theyre causing #135 (#137) --- src/view/com/util/PostCtrls.tsx | 90 +++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 26 deletions(-) diff --git a/src/view/com/util/PostCtrls.tsx b/src/view/com/util/PostCtrls.tsx index dfa90fb59b..6bff5e73d1 100644 --- a/src/view/com/util/PostCtrls.tsx +++ b/src/view/com/util/PostCtrls.tsx @@ -1,6 +1,5 @@ import React from 'react' import { - Animated, StyleProp, StyleSheet, TouchableOpacity, @@ -9,10 +8,11 @@ import { } from 'react-native' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import ReactNativeHapticFeedback from 'react-native-haptic-feedback' -import { - TriggerableAnimated, - TriggerableAnimatedRef, -} from './anim/TriggerableAnimated' +// DISABLED see #135 +// import { +// TriggerableAnimated, +// TriggerableAnimatedRef, +// } from './anim/TriggerableAnimated' import {Text} from './text/Text' import {PostDropdownBtn} from './forms/DropdownButton' import { @@ -44,6 +44,8 @@ interface PostCtrlsOpts { const HITSLOP = {top: 5, left: 5, bottom: 5, right: 5} +// DISABLED see #135 +/* function ctrlAnimStart(interp: Animated.Value) { return Animated.sequence([ Animated.timing(interp, { @@ -76,6 +78,7 @@ function ctrlAnimStyle(interp: Animated.Value) { }), } } +*/ export function PostCtrls(opts: PostCtrlsOpts) { const theme = useTheme() @@ -87,19 +90,25 @@ export function PostCtrls(opts: PostCtrlsOpts) { ) const [repostMod, setRepostMod] = React.useState(0) const [likeMod, setLikeMod] = React.useState(0) - const repostRef = React.useRef(null) - const likeRef = React.useRef(null) + // DISABLED see #135 + // const repostRef = React.useRef(null) + // const likeRef = React.useRef(null) const onPressToggleRepostWrapper = () => { if (!opts.isReposted) { ReactNativeHapticFeedback.trigger('impactMedium') setRepostMod(1) - repostRef.current?.trigger( - {start: ctrlAnimStart, style: ctrlAnimStyle}, - async () => { - await opts.onPressToggleRepost().catch(_e => undefined) - setRepostMod(0) - }, - ) + opts + .onPressToggleRepost() + .catch(_e => undefined) + .then(() => setRepostMod(0)) + // DISABLED see #135 + // repostRef.current?.trigger( + // {start: ctrlAnimStart, style: ctrlAnimStyle}, + // async () => { + // await opts.onPressToggleRepost().catch(_e => undefined) + // setRepostMod(0) + // }, + // ) } else { setRepostMod(-1) opts @@ -112,13 +121,18 @@ export function PostCtrls(opts: PostCtrlsOpts) { if (!opts.isUpvoted) { ReactNativeHapticFeedback.trigger('impactMedium') setLikeMod(1) - likeRef.current?.trigger( - {start: ctrlAnimStart, style: ctrlAnimStyle}, - async () => { - await opts.onPressToggleUpvote().catch(_e => undefined) - setLikeMod(0) - }, - ) + opts + .onPressToggleUpvote() + .catch(_e => undefined) + .then(() => setLikeMod(0)) + // DISABLED see #135 + // likeRef.current?.trigger( + // {start: ctrlAnimStart, style: ctrlAnimStyle}, + // async () => { + // await opts.onPressToggleUpvote().catch(_e => undefined) + // setLikeMod(0) + // }, + // ) } else { setLikeMod(-1) opts @@ -152,7 +166,17 @@ export function PostCtrls(opts: PostCtrlsOpts) { hitSlop={HITSLOP} onPress={onPressToggleRepostWrapper} style={styles.ctrl}> - + 0 + ? styles.ctrlIconReposted + : defaultCtrlColor + } + strokeWidth={2.4} + size={opts.big ? 24 : 20} + /> + { + undefined /*DISABLED see #135 0 @@ -162,8 +186,8 @@ export function PostCtrls(opts: PostCtrlsOpts) { strokeWidth={2.4} size={opts.big ? 24 : 20} /> - - + */ + } {typeof opts.repostCount !== 'undefined' ? ( - + {opts.isUpvoted || likeMod > 0 ? ( + + ) : ( + + )} + { + undefined /*DISABLED see #135 {opts.isUpvoted || likeMod > 0 ? ( )} - + */ + } {typeof opts.upvoteCount !== 'undefined' ? (