2020-09-07 19:18:09 +05:00
|
|
|
import React, {useEffect} from 'react';
|
|
|
|
|
import Animated, {Easing, useValue} from 'react-native-reanimated';
|
2020-05-10 22:14:44 +05:00
|
|
|
import {useTracked} from '../../provider';
|
2020-10-13 17:02:14 +05:00
|
|
|
import {Header} from '../Header';
|
2020-05-10 22:14:44 +05:00
|
|
|
|
|
|
|
|
export const ContainerTopSection = ({root}) => {
|
2020-11-03 10:02:36 +05:00
|
|
|
const [state,] = useTracked();
|
2020-05-10 22:14:44 +05:00
|
|
|
const {colors, selectionMode} = state;
|
2020-09-07 19:18:09 +05:00
|
|
|
const opacity = useValue(0);
|
2020-10-03 14:06:05 +05:00
|
|
|
const translateY = useValue(0);
|
2020-09-07 19:18:09 +05:00
|
|
|
useEffect(() => {
|
|
|
|
|
Animated.timing(opacity, {
|
|
|
|
|
duration: 100,
|
|
|
|
|
toValue: selectionMode ? 0 : 1,
|
|
|
|
|
easing: Easing.in(Easing.ease),
|
|
|
|
|
}).start();
|
2020-10-03 14:06:05 +05:00
|
|
|
Animated.timing(translateY, {
|
|
|
|
|
toValue: selectionMode ? -150 : 0,
|
|
|
|
|
duration: 100,
|
|
|
|
|
easing: Easing.in(Easing.ease),
|
|
|
|
|
}).start();
|
2020-09-07 19:18:09 +05:00
|
|
|
}, [selectionMode]);
|
2020-05-10 22:14:44 +05:00
|
|
|
|
|
|
|
|
return (
|
2020-09-07 19:18:09 +05:00
|
|
|
<Animated.View
|
2020-05-10 22:14:44 +05:00
|
|
|
style={{
|
|
|
|
|
backgroundColor: colors.bg,
|
|
|
|
|
width: '100%',
|
2020-09-07 19:18:09 +05:00
|
|
|
opacity: opacity,
|
2020-10-03 14:06:05 +05:00
|
|
|
overflow: 'hidden',
|
|
|
|
|
transform: [
|
|
|
|
|
{
|
|
|
|
|
translateY: translateY,
|
|
|
|
|
},
|
|
|
|
|
],
|
2020-05-10 22:14:44 +05:00
|
|
|
}}>
|
2020-10-13 17:02:14 +05:00
|
|
|
<Header root={root} />
|
2020-09-07 19:18:09 +05:00
|
|
|
</Animated.View>
|
2020-05-10 22:14:44 +05:00
|
|
|
);
|
|
|
|
|
};
|