mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
refactoring & bug fixes
This commit is contained in:
@@ -7,8 +7,6 @@ import App from './App';
|
|||||||
import {name as appName} from './app.json';
|
import {name as appName} from './app.json';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Provider} from './src/provider';
|
import {Provider} from './src/provider';
|
||||||
import {scale} from './src/common/common';
|
|
||||||
|
|
||||||
const AppProvider = () => {
|
const AppProvider = () => {
|
||||||
return (
|
return (
|
||||||
<Provider>
|
<Provider>
|
||||||
|
|||||||
@@ -346,14 +346,15 @@ 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();
|
|
||||||
openVault(note, false);
|
openVault(note, false);
|
||||||
|
close();
|
||||||
break;
|
break;
|
||||||
case db.vault.ERRORS.vaultLocked:
|
case db.vault.ERRORS.vaultLocked:
|
||||||
openVault(note, true, true);
|
openVault(note, true, true);
|
||||||
|
close();
|
||||||
break;
|
break;
|
||||||
case db.vault.ERRORS.wrongPassword:
|
case db.vault.ERRORS.wrongPassword:
|
||||||
|
close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import {
|
|||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import {FlatList, TextInput} from 'react-native-gesture-handler';
|
import {FlatList, TextInput} from 'react-native-gesture-handler';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
|
||||||
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
|
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
|
||||||
import {ACTIONS} from '../../provider/actions';
|
import {ACTIONS} from '../../provider/actions';
|
||||||
import {getElevation, ToastEvent, db, DDS} from '../../utils/utils';
|
import {getElevation, ToastEvent, db, DDS} from '../../utils/utils';
|
||||||
import {updateEvent} from '../DialogManager/recievers';
|
import {updateEvent} from '../DialogManager/recievers';
|
||||||
|
import {Toast} from '../Toast';
|
||||||
|
|
||||||
let refs = [];
|
let refs = [];
|
||||||
|
|
||||||
@@ -108,14 +108,8 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
let {topics} = this.state;
|
let {topics} = this.state;
|
||||||
let {toEdit} = this.props;
|
let {toEdit} = this.props;
|
||||||
if (!this.title)
|
if (!this.title || this.title.trim().length === 0)
|
||||||
return ToastEvent.show(
|
return ToastEvent.show('Title is required', 'error', 'local');
|
||||||
'Title is required',
|
|
||||||
'error',
|
|
||||||
3000,
|
|
||||||
() => {},
|
|
||||||
'',
|
|
||||||
);
|
|
||||||
|
|
||||||
let id = toEdit && toEdit.id ? toEdit.id : null;
|
let id = toEdit && toEdit.id ? toEdit.id : null;
|
||||||
|
|
||||||
@@ -151,11 +145,7 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
|
|
||||||
onSubmit = () => {
|
onSubmit = () => {
|
||||||
let {topics} = this.state;
|
let {topics} = this.state;
|
||||||
if (
|
if (!this.currentInputValue || this.currentInputValue.trim().length === 0)
|
||||||
!this.currentInputValue ||
|
|
||||||
this.currentInputValue === '' ||
|
|
||||||
this.currentInputValue === ' '
|
|
||||||
)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let prevTopics = [...topics];
|
let prevTopics = [...topics];
|
||||||
@@ -335,7 +325,7 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
onSubmitEditing={() => {
|
onSubmitEditing={() => {
|
||||||
this.topicInputRef.focus();
|
this.topicInputRef.focus();
|
||||||
}}
|
}}
|
||||||
placeholder="write a description"
|
placeholder="Short description about notebook"
|
||||||
placeholderTextColor={colors.icon}
|
placeholderTextColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -494,6 +484,7 @@ export class AddNotebookDialog extends React.Component {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</KeyboardAvoidingView>
|
</KeyboardAvoidingView>
|
||||||
|
<Toast context="local" />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
eOpenAddTopicDialog,
|
eOpenAddTopicDialog,
|
||||||
eOpenMoveNoteDialog,
|
eOpenMoveNoteDialog,
|
||||||
eOpenSimpleDialog,
|
eOpenSimpleDialog,
|
||||||
|
eDispatchAction,
|
||||||
} from '../../services/events';
|
} from '../../services/events';
|
||||||
|
|
||||||
export const ActionSheetEvent = (
|
export const ActionSheetEvent = (
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {DeviceEventEmitter} from 'react-native';
|
import {DeviceEventEmitter} from 'react-native';
|
||||||
|
import {eOpenVaultDialog} from './events';
|
||||||
|
|
||||||
export const eSubscribeEvent = (eventName, action) => {
|
export const eSubscribeEvent = (eventName, action) => {
|
||||||
DeviceEventEmitter.addListener(eventName, action);
|
DeviceEventEmitter.addListener(eventName, action);
|
||||||
|
|||||||
Reference in New Issue
Block a user