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';
|
|
|
|
|
import {Header} from '../header';
|
|
|
|
|
import {Search} from '../SearchInput';
|
|
|
|
|
|
|
|
|
|
export const ContainerTopSection = ({root}) => {
|
|
|
|
|
const [state, dispatch] = useTracked();
|
|
|
|
|
const {colors, selectionMode} = state;
|
2020-09-07 19:18:09 +05:00
|
|
|
const opacity = useValue(0);
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
Animated.timing(opacity, {
|
|
|
|
|
duration: 100,
|
|
|
|
|
toValue: selectionMode ? 0 : 1,
|
|
|
|
|
easing: Easing.in(Easing.ease),
|
|
|
|
|
}).start();
|
|
|
|
|
}, [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={{
|
2020-09-07 19:18:09 +05:00
|
|
|
position: 'absolute',
|
2020-05-10 22:14:44 +05:00
|
|
|
backgroundColor: colors.bg,
|
2020-09-07 19:18:09 +05:00
|
|
|
zIndex: 998,
|
|
|
|
|
display: 'flex',
|
2020-05-10 22:14:44 +05:00
|
|
|
width: '100%',
|
2020-09-07 19:18:09 +05:00
|
|
|
opacity: opacity,
|
2020-05-10 22:14:44 +05:00
|
|
|
}}>
|
2020-09-07 19:18:09 +05:00
|
|
|
<Header root={root} />
|
2020-05-10 22:14:44 +05:00
|
|
|
|
|
|
|
|
<Search root={root} />
|
2020-09-07 19:18:09 +05:00
|
|
|
</Animated.View>
|
2020-05-10 22:14:44 +05:00
|
|
|
);
|
|
|
|
|
};
|