mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import React from 'react'
2import {useStores} from 'state/index'
3import {Animated} from 'react-native'
4import {useAnimatedValue} from 'lib/hooks/useAnimatedValue'
5
6export function useMinimalShellMode() {
7 const store = useStores()
8 const minimalShellInterp = useAnimatedValue(0)
9 const footerMinimalShellTransform = {
10 transform: [{translateY: Animated.multiply(minimalShellInterp, 100)}],
11 }
12
13 React.useEffect(() => {
14 if (store.shell.minimalShellMode) {
15 Animated.timing(minimalShellInterp, {
16 toValue: 1,
17 duration: 100,
18 useNativeDriver: true,
19 isInteraction: false,
20 }).start()
21 } else {
22 Animated.timing(minimalShellInterp, {
23 toValue: 0,
24 duration: 100,
25 useNativeDriver: true,
26 isInteraction: false,
27 }).start()
28 }
29 }, [minimalShellInterp, store.shell.minimalShellMode])
30
31 return {footerMinimalShellTransform}
32}