minor refactor

This commit is contained in:
ammarahm-ed
2020-05-10 22:21:31 +05:00
parent 0d0f4cddbe
commit dab42a2e35
2 changed files with 16 additions and 11 deletions

View File

@@ -90,14 +90,14 @@ export const ActionSheetComponent = ({
if (tag.includes(',')) { if (tag.includes(',')) {
tag = tag.replace(',', ''); tag = tag.replace(',', '');
} }
tagsInputRef.current?.setNativeProps({
text: '',
});
await db.notes.note(note.id).tag(tag); await db.notes.note(note.id).tag(tag);
setNote({...db.notes.note(note.id).data}); setNote({...db.notes.note(note.id).data});
dispatch({type: ACTIONS.TAGS}); dispatch({type: ACTIONS.TAGS});
tagsInputRef.current?.setNativeProps({
text: '',
});
tagToAdd = ''; tagToAdd = '';
}; };
@@ -351,7 +351,6 @@ export const ActionSheetComponent = ({
.catch(async e => { .catch(async e => {
switch (e.message) { switch (e.message) {
case db.vault.ERRORS.noVault: case db.vault.ERRORS.noVault:
close('novault'); close('novault');
break; break;
case db.vault.ERRORS.vaultLocked: case db.vault.ERRORS.vaultLocked:

View File

@@ -1,4 +1,4 @@
import React, { createRef } from 'react'; import React, {createRef} from 'react';
import {Modal, TouchableOpacity, View} from 'react-native'; import {Modal, TouchableOpacity, View} from 'react-native';
import * as Animatable from 'react-native-animatable'; import * as Animatable from 'react-native-animatable';
import {normalize} from '../../common/common'; import {normalize} from '../../common/common';
@@ -12,13 +12,17 @@ import Signup from '../../views/Signup';
import {updateEvent} from '../DialogManager/recievers'; import {updateEvent} from '../DialogManager/recievers';
import {NavigationContainer} from '@react-navigation/native'; import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack'; import {createStackNavigator} from '@react-navigation/stack';
import Container from '../Container';
const Stack = createStackNavigator(); const Stack = createStackNavigator();
const modalNavigatorRef2 = createRef(); const modalNavigatorRef2 = createRef();
const ModalNavigator = ({onStateChange}) => { const ModalNavigator = ({onStateChange}) => {
return ( return (
<NavigationContainer onStateChange={onStateChange} independent={true} ref={modalNavigatorRef2}> <NavigationContainer
onStateChange={onStateChange}
independent={true}
ref={modalNavigatorRef2}>
<Stack.Navigator <Stack.Navigator
initialRouteName="Login" initialRouteName="Login"
screenOptions={{ screenOptions={{
@@ -127,11 +131,13 @@ class LoginDialog extends React.Component {
paddingVertical: 16, paddingVertical: 16,
zIndex: 10, zIndex: 10,
}}> }}>
<Container>
<ModalNavigator <ModalNavigator
onStateChange={event => { onStateChange={event => {
this.routeIndex = event.index; this.routeIndex = event.index;
}} }}
/> />
</Container>
</View> </View>
</Animatable.View> </Animatable.View>
</Modal> </Modal>