update drawer open/close functions

This commit is contained in:
ammarahm-ed
2020-09-21 13:01:37 +05:00
parent 44111d73ca
commit e66274e4b3
4 changed files with 21 additions and 21 deletions

View File

@@ -1,14 +1,12 @@
import React, {useEffect} from 'react'; import React, { useEffect } from 'react';
import {Text, View} from 'react-native'; import { Text, View } from 'react-native';
import {COLORS_NOTE, normalize, pv, SIZE} from '../../common/common'; import { COLORS_NOTE, SIZE } from '../../common/common';
import {useTracked} from '../../provider'; import { useTracked } from '../../provider';
import {ACTIONS} from '../../provider/actions'; import { ACTIONS } from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager'; import { eSendEvent } from '../../services/eventManager';
import {refreshNotesPage} from '../../services/events'; import { refreshNotesPage } from '../../services/events';
import NavigationService from '../../services/NavigationService'; import NavigationService from '../../services/NavigationService';
import {sideMenuRef} from '../../utils/refs'; import { PressableButton } from '../PressableButton';
import {hexToRGBA, RGB_Linear_Shade} from '../../utils/utils';
import {PressableButton} from '../PressableButton';
export const ColorSection = ({noTextMode}) => { export const ColorSection = ({noTextMode}) => {
const [state, dispatch] = useTracked(); const [state, dispatch] = useTracked();
@@ -61,7 +59,7 @@ export const ColorSection = ({noTextMode}) => {
NavigationService.navigate('Notes', params); NavigationService.navigate('Notes', params);
eSendEvent(refreshNotesPage, params); eSendEvent(refreshNotesPage, params);
sideMenuRef.current?.closeDrawer(); NavigationService.closeDrawer();
}} }}
customStyle={{ customStyle={{
flexDirection: 'row', flexDirection: 'row',

View File

@@ -1,13 +1,13 @@
import React from 'react'; import React from 'react';
import {Text, TouchableOpacity, View} from 'react-native'; import { Text, View } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {normalize, opacity, pv, SIZE, WEIGHT} from '../../common/common'; import { SIZE, WEIGHT } from '../../common/common';
import {useTracked} from '../../provider'; import { useTracked } from '../../provider';
import {ACTIONS} from '../../provider/actions'; import { ACTIONS } from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager'; import { eSendEvent } from '../../services/eventManager';
import {eClearSearch} from '../../services/events'; import { eClearSearch } from '../../services/events';
import {sideMenuRef} from '../../utils/refs'; import NavigationService from '../../services/NavigationService';
import {PressableButton} from '../PressableButton'; import { PressableButton } from '../PressableButton';
export const MenuListItem = ({item, index, noTextMode, ignore}) => { export const MenuListItem = ({item, index, noTextMode, ignore}) => {
const [state, dispatch] = useTracked(); const [state, dispatch] = useTracked();
@@ -26,7 +26,7 @@ export const MenuListItem = ({item, index, noTextMode, ignore}) => {
item.func(); item.func();
if (item.close) { if (item.close) {
sideMenuRef.current?.closeDrawer(); NavigationService.closeDrawer();
} }
}; };

View File

@@ -29,6 +29,7 @@ import {MenuListItem} from './MenuListItem';
import {TagsSection} from './TagsSection'; import {TagsSection} from './TagsSection';
import {UserSection} from './UserSection'; import {UserSection} from './UserSection';
import {MMKV} from '../../utils/storage'; import {MMKV} from '../../utils/storage';
import Seperator from '../Seperator';
const AnimatedSafeAreaView = createAnimatableComponent(SafeAreaView); const AnimatedSafeAreaView = createAnimatableComponent(SafeAreaView);
@@ -202,6 +203,7 @@ export const Menu = ({
/> />
))} ))}
</View> </View>
<Seperator half />
<UserSection noTextMode={noTextMode} /> <UserSection noTextMode={noTextMode} />
</View> </View>

View File

@@ -30,7 +30,7 @@ export const Header = ({showSearch, root}) => {
const onLeftButtonPress = () => { const onLeftButtonPress = () => {
if (!headerState.canGoBack) { if (!headerState.canGoBack) {
sideMenuRef.current?.openDrawer(); NavigationService.openDrawer();
return; return;
} }
NavigationService.goBack(); NavigationService.goBack();