56ab5e177f
* show quote posts
* fix filter
* fix keyExtractor
* move likedby and repostedby to new file structure
* use modern list component
* remove relative imports
* update quotes count after quoting
* call `onPost` after updating quote count
* Revert "update quotes count after quoting"
This reverts commit 1f1887730a.
* implement
* update like count in quotes list
* only add `onPostReply` where needed
* Filter quotes with detached embeds
* Bump SDK
* Don't show error for no results
---------
Co-authored-by: Samuel Newman <10959775+mozzius@users.noreply.github.com>
Co-authored-by: Hailey <me@haileyok.com>
Co-authored-by: Eric Bailey <git@esb.lol>
75 lines
1.6 KiB
TypeScript
75 lines
1.6 KiB
TypeScript
import React, {useEffect} from 'react'
|
|
import {Animated, Easing, StyleSheet, View} from 'react-native'
|
|
import {observer} from 'mobx-react-lite'
|
|
|
|
import {useAnimatedValue} from 'lib/hooks/useAnimatedValue'
|
|
import {usePalette} from 'lib/hooks/usePalette'
|
|
import {useComposerState} from 'state/shell/composer'
|
|
import {ComposePost} from '../com/composer/Composer'
|
|
|
|
export const Composer = observer(function ComposerImpl({
|
|
winHeight,
|
|
}: {
|
|
winHeight: number
|
|
}) {
|
|
const state = useComposerState()
|
|
const pal = usePalette('default')
|
|
const initInterp = useAnimatedValue(0)
|
|
|
|
useEffect(() => {
|
|
if (state) {
|
|
Animated.timing(initInterp, {
|
|
toValue: 1,
|
|
duration: 300,
|
|
easing: Easing.out(Easing.exp),
|
|
useNativeDriver: true,
|
|
}).start()
|
|
} else {
|
|
initInterp.setValue(0)
|
|
}
|
|
}, [initInterp, state])
|
|
const wrapperAnimStyle = {
|
|
transform: [
|
|
{
|
|
translateY: initInterp.interpolate({
|
|
inputRange: [0, 1],
|
|
outputRange: [winHeight, 0],
|
|
}),
|
|
},
|
|
],
|
|
}
|
|
|
|
// rendering
|
|
// =
|
|
|
|
if (!state) {
|
|
return <View />
|
|
}
|
|
|
|
return (
|
|
<Animated.View
|
|
style={[styles.wrapper, pal.view, wrapperAnimStyle]}
|
|
aria-modal
|
|
accessibilityViewIsModal>
|
|
<ComposePost
|
|
replyTo={state.replyTo}
|
|
onPost={state.onPost}
|
|
quote={state.quote}
|
|
quoteCount={state.quoteCount}
|
|
mention={state.mention}
|
|
text={state.text}
|
|
imageUris={state.imageUris}
|
|
/>
|
|
</Animated.View>
|
|
)
|
|
})
|
|
|
|
const styles = StyleSheet.create({
|
|
wrapper: {
|
|
position: 'absolute',
|
|
top: 0,
|
|
bottom: 0,
|
|
width: '100%',
|
|
},
|
|
})
|