Files
notesnook/apps/mobile/src/components/Header/HeaderRightMenu.js

106 lines
2.4 KiB
JavaScript
Raw Normal View History

2020-11-20 01:20:34 +05:00
import React from 'react';
2020-11-23 17:33:14 +05:00
import {ActivityIndicator, StyleSheet, View} from 'react-native';
2020-11-20 01:20:34 +05:00
import {useTracked} from '../../provider';
import {DDS} from '../../services/DeviceDetection';
import NavigationService from '../../services/Navigation';
import {dWidth} from '../../utils';
import {SIZE} from '../../utils/SizeUtils';
import {ActionIcon} from '../ActionIcon';
2020-11-23 17:33:14 +05:00
import {Button} from '../Button';
2020-11-20 01:20:34 +05:00
export const HeaderRightMenu = () => {
2020-11-23 17:33:14 +05:00
const [state] = useTracked();
const {colors, containerBottomButton, currentScreen, syncing} = state;
2020-11-20 01:20:34 +05:00
return (
<View style={styles.rightBtnContainer}>
2020-11-23 17:33:14 +05:00
{syncing && <ActivityIndicator size={SIZE.xl} color={colors.accent} />}
2020-11-20 01:20:34 +05:00
<ActionIcon
onPress={async () => {
NavigationService.navigate('Search');
}}
name="magnify"
size={SIZE.xxxl}
color={colors.pri}
customStyle={styles.rightBtn}
/>
2020-11-23 17:33:14 +05:00
2020-11-20 01:20:34 +05:00
{DDS.isLargeTablet() && containerBottomButton.onPress ? (
<Button
2020-11-23 17:33:14 +05:00
onPress={() => {
containerBottomButton.onPress();
2020-11-20 01:20:34 +05:00
}}
2020-11-23 17:33:14 +05:00
icon={currentScreen === 'trash' ? 'delete' : 'plus'}
2020-11-20 01:20:34 +05:00
iconSize={SIZE.xl}
type="shade"
style={{
marginLeft: 20,
2020-11-23 17:33:14 +05:00
width: 60,
height: 35,
2020-11-20 01:20:34 +05:00
}}
/>
) : null}
</View>
);
};
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
zIndex: 11,
height: 50,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 12,
width: '100%',
},
loadingContainer: {
alignSelf: 'center',
alignItems: 'center',
justifyContent: 'center',
zIndex: 999,
left: dWidth / 2 - 20,
top: -20,
width: 40,
height: 40,
position: 'absolute',
},
loadingInnerContainer: {
width: 40,
height: 20,
position: 'absolute',
zIndex: 10,
top: 0,
},
leftBtnContainer: {
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
position: 'absolute',
left: 12,
},
leftBtn: {
justifyContent: 'center',
alignItems: 'center',
height: 40,
width: 40,
borderRadius: 100,
marginLeft: -5,
marginRight: 25,
},
rightBtnContainer: {
flexDirection: 'row',
alignItems: 'center',
position: 'absolute',
right: 12,
},
rightBtn: {
justifyContent: 'center',
alignItems: 'flex-end',
height: 40,
width: 50,
paddingRight: 0,
},
});