Skip to content

Commit 4e6b674

Browse files
authored
[Video] Enter/exit animations for video in composer (#5164)
* enter/exit animations for video in composer * use zoom out animation * unify margin between different steps * skip animation when posting
1 parent 428607d commit 4e6b674

File tree

3 files changed

+35
-26
lines changed

3 files changed

+35
-26
lines changed

src/view/com/composer/Composer.tsx

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ import Animated, {
2424
FadeIn,
2525
FadeOut,
2626
interpolateColor,
27+
LayoutAnimationConfig,
2728
useAnimatedStyle,
2829
useDerivedValue,
2930
useSharedValue,
3031
withRepeat,
3132
withTiming,
33+
ZoomIn,
34+
ZoomOut,
3235
} from 'react-native-reanimated'
3336
import {useSafeAreaInsets} from 'react-native-safe-area-context'
3437
import {
@@ -84,7 +87,7 @@ import {GalleryModel} from 'state/models/media/gallery'
8487
import {State as VideoUploadState} from 'state/queries/video/video'
8588
import {ComposerOpts} from 'state/shell/composer'
8689
import {ComposerReplyTo} from 'view/com/composer/ComposerReplyTo'
87-
import {atoms as a, useTheme} from '#/alf'
90+
import {atoms as a, native, useTheme} from '#/alf'
8891
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
8992
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
9093
import {EmojiArc_Stroke2_Corner0_Rounded as EmojiSmile} from '#/components/icons/Emoji'
@@ -766,29 +769,36 @@ export const ComposePost = observer(function ComposePost({
766769
)}
767770
</View>
768771
) : null}
769-
{videoUploadState.asset &&
770-
(videoUploadState.status === 'compressing' ? (
771-
<VideoTranscodeProgress
772-
asset={videoUploadState.asset}
773-
progress={videoUploadState.progress}
774-
clear={clearVideo}
775-
/>
776-
) : videoUploadState.video ? (
777-
<VideoPreview
778-
asset={videoUploadState.asset}
779-
video={videoUploadState.video}
780-
setDimensions={updateVideoDimensions}
781-
clear={clearVideo}
782-
/>
783-
) : null)}
784-
{(videoUploadState.asset || videoUploadState.video) && (
785-
<SubtitleDialogBtn
786-
altText={videoAltText}
787-
setAltText={setVideoAltText}
788-
captions={captions}
789-
setCaptions={setCaptions}
790-
/>
791-
)}
772+
<LayoutAnimationConfig skipExiting>
773+
{(videoUploadState.asset || videoUploadState.video) && (
774+
<Animated.View
775+
style={[a.w_full, a.mt_xs]}
776+
entering={native(ZoomIn)}
777+
exiting={native(ZoomOut)}>
778+
{videoUploadState.asset &&
779+
(videoUploadState.status === 'compressing' ? (
780+
<VideoTranscodeProgress
781+
asset={videoUploadState.asset}
782+
progress={videoUploadState.progress}
783+
clear={clearVideo}
784+
/>
785+
) : videoUploadState.video ? (
786+
<VideoPreview
787+
asset={videoUploadState.asset}
788+
video={videoUploadState.video}
789+
setDimensions={updateVideoDimensions}
790+
clear={clearVideo}
791+
/>
792+
) : null)}
793+
<SubtitleDialogBtn
794+
altText={videoAltText}
795+
setAltText={setVideoAltText}
796+
captions={captions}
797+
setCaptions={setCaptions}
798+
/>
799+
</Animated.View>
800+
)}
801+
</LayoutAnimationConfig>
792802
</View>
793803
</Animated.ScrollView>
794804
<SuggestedLanguage text={richtext.text} />

src/view/com/composer/videos/SubtitleDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function SubtitleDialogBtn(props: Props) {
3434
const {_} = useLingui()
3535

3636
return (
37-
<View style={[a.flex_row, a.mt_xs]}>
37+
<View style={[a.flex_row, a.my_xs]}>
3838
<Button
3939
label={isWeb ? _('Captions & alt text') : _('Alt text')}
4040
accessibilityHint={

src/view/com/composer/videos/VideoTranscodeProgress.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export function VideoTranscodeProgress({
3535
<View
3636
style={[
3737
a.w_full,
38-
a.mt_md,
3938
t.atoms.bg_contrast_50,
4039
a.rounded_md,
4140
a.overflow_hidden,

0 commit comments

Comments
 (0)