Bluesky app fork with some witchin' additions 馃挮
at main 62 lines 1.5 kB view raw
1import {useEffect} from 'react' 2import {Animated, Easing} from 'react-native' 3 4import {useAnimatedValue} from '#/lib/hooks/useAnimatedValue' 5import {useComposerState} from '#/state/shell/composer' 6import {atoms as a, useTheme} from '#/alf' 7import {ComposePost} from '../com/composer/Composer' 8 9export function Composer({winHeight}: {winHeight: number}) { 10 const state = useComposerState() 11 const t = useTheme() 12 const initInterp = useAnimatedValue(0) 13 14 useEffect(() => { 15 if (state) { 16 Animated.timing(initInterp, { 17 toValue: 1, 18 duration: 300, 19 easing: Easing.out(Easing.exp), 20 useNativeDriver: true, 21 }).start() 22 } else { 23 initInterp.setValue(0) 24 } 25 }, [initInterp, state]) 26 const wrapperAnimStyle = { 27 transform: [ 28 { 29 translateY: initInterp.interpolate({ 30 inputRange: [0, 1], 31 outputRange: [winHeight, 0], 32 }), 33 }, 34 ], 35 } 36 37 // rendering 38 // = 39 40 if (!state) { 41 return null 42 } 43 44 return ( 45 <Animated.View 46 style={[a.absolute, a.inset_0, t.atoms.bg, wrapperAnimStyle]} 47 aria-modal 48 accessibilityViewIsModal> 49 <ComposePost 50 replyTo={state.replyTo} 51 onPost={state.onPost} 52 onPostSuccess={state.onPostSuccess} 53 quote={state.quote} 54 mention={state.mention} 55 text={state.text} 56 imageUris={state.imageUris} 57 videoUri={state.videoUri} 58 openGallery={state.openGallery} 59 /> 60 </Animated.View> 61 ) 62}