From f84c85aac6811e76f58b12e8880e0897f4331d66 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 5 Jun 2026 00:37:42 +0300 Subject: [PATCH] Use Reanimated layout animations for Android composer (#8546) --- src/view/shell/Composer.ios.tsx | 23 ++++++++------- src/view/shell/Composer.tsx | 52 ++++++++++++++------------------- src/view/shell/Composer.web.tsx | 7 ++--- src/view/shell/index.tsx | 4 +-- src/view/shell/index.web.tsx | 2 +- 5 files changed, 38 insertions(+), 50 deletions(-) diff --git a/src/view/shell/Composer.ios.tsx b/src/view/shell/Composer.ios.tsx index 437e610b20..7a1f599374 100644 --- a/src/view/shell/Composer.ios.tsx +++ b/src/view/shell/Composer.ios.tsx @@ -1,29 +1,30 @@ -import {useEffect, useRef} from 'react' +import {useEffect} from 'react' import {Modal, View} from 'react-native' +import {SystemBars} from 'react-native-edge-to-edge' -import {useDialogStateControlContext} from '#/state/dialogs' import {useComposerState} from '#/state/shell/composer' import {ComposePost, useComposerCancelRef} from '#/view/com/composer/Composer' import {atoms as a, useTheme} from '#/alf' import {SheetCompatProvider as TooltipSheetCompatProvider} from '#/components/Tooltip' +import {IS_LIQUID_GLASS} from '#/env' -export function Composer({}: {winHeight: number}) { - const {setFullyExpandedCount} = useDialogStateControlContext() +export function Composer() { const t = useTheme() const state = useComposerState() const ref = useComposerCancelRef() const open = !!state - const prevOpen = useRef(open) useEffect(() => { - if (open && !prevOpen.current) { - setFullyExpandedCount(c => c + 1) - } else if (!open && prevOpen.current) { - setFullyExpandedCount(c => c - 1) + if (open && !IS_LIQUID_GLASS) { + const entry = SystemBars.pushStackEntry({ + style: { + statusBar: 'light', + }, + }) + return () => SystemBars.popStackEntry(entry) } - prevOpen.current = open - }, [open, setFullyExpandedCount]) + }, [open]) return ( { - if (state) { - Animated.timing(initInterp, { - toValue: 1, - duration: 300, - easing: Easing.out(Easing.exp), - useNativeDriver: true, - }).start() - } else { - initInterp.setValue(0) + if (open) { + const entry = SystemBars.pushStackEntry({ + style: { + statusBar: t.name !== 'light' ? 'light' : 'dark', + }, + }) + return () => SystemBars.popStackEntry(entry) } - }, [initInterp, state]) - const wrapperAnimStyle = { - transform: [ - { - translateY: initInterp.interpolate({ - inputRange: [0, 1], - outputRange: [winHeight, 0], - }), - }, - ], - } + }, [open, t.name]) - // rendering - // = - - if (!state) { + if (!open) { return null } return ( - - + diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx index bfce0729d2..62dec9bcf7 100644 --- a/src/view/shell/index.web.tsx +++ b/src/view/shell/index.web.tsx @@ -64,7 +64,7 @@ function ShellInner() { - +