Files
notesnook/apps/mobile/src/components/Container/ContainerTopSection.js

35 lines
880 B
JavaScript
Raw Normal View History

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;
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 (
<Animated.View
2020-05-10 22:14:44 +05:00
style={{
position: 'absolute',
2020-05-10 22:14:44 +05:00
backgroundColor: colors.bg,
zIndex: 998,
display: 'flex',
2020-05-10 22:14:44 +05:00
width: '100%',
opacity: opacity,
2020-05-10 22:14:44 +05:00
}}>
<Header root={root} />
2020-05-10 22:14:44 +05:00
<Search root={root} />
</Animated.View>
2020-05-10 22:14:44 +05:00
);
};