diff --git a/src/components/Post/Embed/VideoEmbed/GifPresentationControls.tsx b/src/components/Post/Embed/VideoEmbed/GifPresentationControls.tsx index 42098a7e9c..f89e5a8ef0 100644 --- a/src/components/Post/Embed/VideoEmbed/GifPresentationControls.tsx +++ b/src/components/Post/Embed/VideoEmbed/GifPresentationControls.tsx @@ -1,11 +1,16 @@ -import {Pressable, StyleSheet, TouchableOpacity, View} from 'react-native' +import { + ActivityIndicator, + StyleSheet, + TouchableOpacity, + View, +} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {HITSLOP_20} from '#/lib/constants' import {atoms as a, useTheme} from '#/alf' +import {Button} from '#/components/Button' import {Fill} from '#/components/Fill' -import {Loader} from '#/components/Loader' import * as Prompt from '#/components/Prompt' import {Text} from '#/components/Typography' import {PlayButtonIcon} from '#/components/video/PlayButtonIcon' @@ -26,28 +31,27 @@ export function GifPresentationControls({ return ( <> - {isLoading ? ( - + ) : !isPlaying ? ( - ) : undefined} - + ) : ( + <> + )} + {!isPlaying && ( - {showOverlay && ( - - )} + {showOverlay && + (embed.presentation === 'gif' ? ( + { + ref.current?.togglePlayback() + }} + altText={embed.alt} + /> + ) : ( + + ))} ) diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 1c2f6c209d..425440609b 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -1115,7 +1115,7 @@ export const ComposePost = ({ onLayout={onScrollViewLayout}> {replyTo ? : undefined} {thread.posts.map((post, index) => ( - + - + {!!post.text.trim().length && ( + + )} {!mediaExistsOnOtherDevice && } diff --git a/src/view/com/composer/drafts/state/queries.ts b/src/view/com/composer/drafts/state/queries.ts index 436e16317f..e66c9d023b 100644 --- a/src/view/com/composer/drafts/state/queries.ts +++ b/src/view/com/composer/drafts/state/queries.ts @@ -184,7 +184,7 @@ export function useSaveDraftMutation() { } } - queryClient.invalidateQueries({queryKey: DRAFTS_QUERY_KEY}) + await queryClient.invalidateQueries({queryKey: DRAFTS_QUERY_KEY}) }, onError: error => { // Check for draft limit error diff --git a/src/view/com/composer/text-input/TextInput.tsx b/src/view/com/composer/text-input/TextInput.tsx index f9f50497f8..0ba2e958a6 100644 --- a/src/view/com/composer/text-input/TextInput.tsx +++ b/src/view/com/composer/text-input/TextInput.tsx @@ -224,9 +224,9 @@ export function TextInput({ onPaste={onPaste} onSelectionChange={onSelectionChange} placeholder={placeholder} - placeholderTextColor={t.atoms.text_contrast_medium.color} + placeholderTextColor={t.atoms.text_contrast_low.color} keyboardAppearance={theme.colorScheme} - autoFocus={true} + autoFocus={props.autoFocus !== undefined ? props.autoFocus : true} allowFontScaling multiline scrollEnabled={false} diff --git a/src/view/com/composer/text-input/TextInput.web.tsx b/src/view/com/composer/text-input/TextInput.web.tsx index a087a3d69b..3068c8f9df 100644 --- a/src/view/com/composer/text-input/TextInput.web.tsx +++ b/src/view/com/composer/text-input/TextInput.web.tsx @@ -52,6 +52,7 @@ export function TextInput({ onPressPublish, onNewLink, onFocus, + autoFocus, }: TextInputProps) { const {theme: t, fonts} = useAlf() const autocomplete = useActorAutocompleteFn() @@ -244,20 +245,10 @@ export function TextInput({ content: generateJSON(richTextToHTML(richtext), extensions, { preserveWhitespace: 'full', }), - autofocus: 'end', + autofocus: autoFocus ? 'end' : null, editable: true, injectCSS: true, shouldRerenderOnTransaction: false, - onCreate({editor: editorProp}) { - // HACK - // the 'enter' animation sometimes causes autofocus to fail - // (see Composer.web.tsx in shell) - // so we wait 200ms (the anim is 150ms) and then focus manually - // -prf - setTimeout(() => { - editorProp.chain().focus('end').run() - }, 200) - }, onUpdate({editor: editorProp}) { const json = editorProp.getJSON() const newText = editorJsonToText(json)