improve contract, fix double tap

This commit is contained in:
Samuel Newman
2025-01-16 17:03:04 +00:00
committed by Eric Bailey
parent 6d242c3891
commit cfbb50c11a
+4 -13
View File
@@ -444,7 +444,6 @@ function VibeOverlay({
const insets = useSafeAreaInsets() const insets = useSafeAreaInsets()
const t = useTheme() const t = useTheme()
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const [expanded, setExpanded] = useState(false)
const {status} = useEvent(player, 'statusChange', {status: player.status}) const {status} = useEvent(player, 'statusChange', {status: player.status})
const doubleTapRef = useRef<ReturnType<typeof setTimeout> | null>(null) const doubleTapRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const [queueLike] = usePostLikeMutationQueue(post, 'Vibe') const [queueLike] = usePostLikeMutationQueue(post, 'Vibe')
@@ -454,6 +453,7 @@ function VibeOverlay({
}) })
const togglePlayPause = () => { const togglePlayPause = () => {
doubleTapRef.current = null
if (player.playing) { if (player.playing) {
player.pause() player.pause()
} else { } else {
@@ -467,7 +467,7 @@ function VibeOverlay({
doubleTapRef.current = null doubleTapRef.current = null
queueLike() queueLike()
} else { } else {
doubleTapRef.current = setTimeout(togglePlayPause, 300) doubleTapRef.current = setTimeout(togglePlayPause, 200)
} }
} }
@@ -506,11 +506,7 @@ function VibeOverlay({
<View /> <View />
</Button> </Button>
<LinearGradient <LinearGradient
colors={ colors={['rgba(0,0,0,0)', 'rgba(0,0,0,0.8)', 'rgba(0,0,0,0.95)']}
expanded
? ['rgba(0,0,0,0)', 'rgba(0,0,0,0.6)', 'rgba(0,0,0,0.8)']
: ['rgba(0,0,0,0)', 'rgba(0,0,0,0.8)']
}
style={[a.w_full, a.px_xl, a.py_sm, a.gap_md]}> style={[a.w_full, a.px_xl, a.py_sm, a.gap_md]}>
<View style={[a.flex_row, a.gap_md, a.align_center]}> <View style={[a.flex_row, a.gap_md, a.align_center]}>
<PreviewableUserAvatar profile={post.author} size={32} /> <PreviewableUserAvatar profile={post.author} size={32} />
@@ -529,8 +525,6 @@ function VibeOverlay({
</View> </View>
{record?.text?.trim() && ( {record?.text?.trim() && (
<ExpandableRichTextView <ExpandableRichTextView
expanded={expanded}
setExpanded={setExpanded}
value={richText} value={richText}
authorHandle={post.author.handle} authorHandle={post.author.handle}
/> />
@@ -573,15 +567,12 @@ function VibeOverlay({
function ExpandableRichTextView({ function ExpandableRichTextView({
value, value,
authorHandle, authorHandle,
expanded,
setExpanded,
}: { }: {
value: RichTextAPI value: RichTextAPI
authorHandle?: string authorHandle?: string
expanded: boolean
setExpanded: React.Dispatch<React.SetStateAction<boolean>>
}) { }) {
const {height: screenHeight} = useWindowDimensions() const {height: screenHeight} = useWindowDimensions()
const [expanded, setExpanded] = useState(false)
const [constrained, setConstrained] = useState(false) const [constrained, setConstrained] = useState(false)
const [contentHeight, setContentHeight] = useState(0) const [contentHeight, setContentHeight] = useState(0)
const {_} = useLingui() const {_} = useLingui()