A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
minor improvements
ammarahm-edb7db84111822
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex 1da928c89..34d7bc2dc 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -7,11 +7,8 @@ import {View,DeviceEventEmitter,Platform,- Keyboard,Animated,} from 'react-native';-import Icon from 'react-native-vector-icons/Ionicons';-import ActionButton from 'react-native-action-button';import * as Animatable from 'react-native-animatable';import {h, w} from './src/utils/utils';import {Toast} from './src/components/Toast';@@ -22,6 +19,7 @@ import StorageInterface from './src/utils/storage';import {AppProvider} from './src/provider';import {DeviceDetectionService} from './src/utils/deviceDetection';import {useAppContext} from './src/provider/useAppContext';+export const DDS = new DeviceDetectionService();export const db = new Storage(StorageInterface);diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.jsindex 317be9ae4..4cca4b332 100644--- a/apps/mobile/src/components/AddNotebookDialog/index.js+++ b/apps/mobile/src/components/AddNotebookDialog/index.js@@ -1,32 +1,17 @@-import React, {useEffect, useState, createRef} from 'react';+import React, {useState, createRef} from 'react';import {- ScrollView,View,Text,TouchableOpacity,- Dimensions,- Image,- SafeAreaView,Platform,Modal,KeyboardAvoidingView,} from 'react-native';-import NavigationService from '../../services/NavigationService';-import {- COLOR_SCHEME,- SIZE,- br,- ph,- pv,- opacity,- FONT,- WEIGHT,-} from '../../common/common';+import {SIZE, ph, pv, opacity, WEIGHT} from '../../common/common';import Icon from 'react-native-vector-icons/Feather';-import {getElevation, h, w, timeSince, ToastEvent} from '../../utils/utils';+import {getElevation, ToastEvent} from '../../utils/utils';import {FlatList, TextInput} from 'react-native-gesture-handler';-import {useForceUpdate} from '../../views/ListsEditor';import {db, DDS} from '../../../App';import {useAppContext} from '../../provider/useAppContext';@@ -36,28 +21,30 @@ export const AddNotebookDialog = ({visible, close}) => {const {colors} = useAppContext();const [topics, setTopics] = useState(['']);const [title, setTitle] = useState(null);- const forceUpdate = useForceUpdate();let listRef = createRef();let prevItem = null;let prevIndex = null;- let currentSelectedItem = null;+ let currentSelectedInput = null;let description = 'my first notebook';const onSubmit = (text, index, willFocus = true) => {- let oldData = topics;- oldData[index] = text;+ let prevTopics = topics;+ prevTopics[index] = text;if (- oldData.length === index + 1 &&+ prevTopics.length === index + 1 &&prevIndex !== null &&prevItem !== null) {- oldData.push('');+ prevTopics.push('');}- setTopics(oldData);- forceUpdate();- currentSelectedItem = null;++ let nextTopics = [...prevTopics];++ setTopics(nextTopics);++ currentSelectedInput = null;//if (!willFocus) return;if (!refs[index + 1]) {@@ -73,31 +60,39 @@ export const AddNotebookDialog = ({visible, close}) => {}};const onFocus = index => {- currentSelectedItem = index;- if (currentSelectedItem) {- let oldData = topics;- oldData[prevIndex] = prevItem;- if (oldData.length === prevIndex + 1) {- oldData.push('');+ currentSelectedInput = index;++ if (currentSelectedInput) {+ let prevTopics = topics;++ prevTopics[prevIndex] = prevItem;+ if (prevTopics.length === prevIndex + 1) {+ prevTopics.push('');}prevIndex = null;prevItem = null;- setTopics(oldData);- forceUpdate();++ let nextTopics = [...prevTopics];++ setTopics(nextTopics);}};const onChange = (text, index) => {prevIndex = index;prevItem = text;};+const onDelete = index => {- let listData = topics;- if (listData.length === 1) return;- refs.splice(index, 1);- listData.splice(index, 1);+ let prevTopics = topics;- setTopics(listData);- forceUpdate();+ if (prevTopics.length === 1) return;++ refs = [];+ prevTopics.splice(index, 1);++ let nextTopics = [...prevTopics];++ setTopics(nextTopics);};const addNewNotebook = async () => {@@ -113,7 +108,7 @@ export const AddNotebookDialog = ({visible, close}) => {setTopics(['']);prevIndex = null;prevItem = null;- currentSelectedItem = null;+ currentSelectedInput = null;refs = [];close(true);};@@ -252,10 +247,12 @@ export const AddNotebookDialog = ({visible, close}) => {activeOpacity={opacity}onPress={() => {setTopics(['']);++ refs = [];prevIndex = null;prevItem = null;- currentSelectedItem = null;- refs = [];+ currentSelectedInput = null;+close();}}style={{@@ -313,7 +310,6 @@ const TopicItem = ({ref={topicRef}onFocus={() => {onFocus(index);-setFocus(true);}}onBlur={() => {diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.jsindex 4bb6ee5b1..31d3b6092 100644--- a/apps/mobile/src/components/NotebookItem/index.js+++ b/apps/mobile/src/components/NotebookItem/index.js@@ -126,7 +126,7 @@ export const NotebookItem = ({numberOfLines={1}style={{fontFamily: WEIGHT.bold,- fontSize: SIZE.sm,+ fontSize: SIZE.md,color: colors.pri,maxWidth: '100%',}}>@@ -137,9 +137,9 @@ export const NotebookItem = ({numberOfLines={numColumns === 2 ? 3 : 2}style={{fontFamily: WEIGHT.regular,- fontSize: SIZE.xs,+ fontSize: SIZE.xs + 1,lineHeight: SIZE.sm,- color: colors.icon,+ color: colors.pri,maxWidth: '100%',paddingVertical: 5,height: numColumns === 2 ? SIZE.sm * 3.5 : null,diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex 6149e809d..e62ea6e30 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -33,12 +33,13 @@ let titleRef;let EditorWebView;const Editor = ({navigation}) => {- // STATE-+ // Global Stateconst {colors} = useAppContext();++ // Local State+const [dialog, setDialog] = useState(false);const [isOpen, setOpen] = useState(false);- const [hide, setHide] = useState(true);const [sidebar, setSidebar] = useState(DDS.isTab ? true : false);// VARIABLESlet updateInterval = null;@@ -227,7 +228,6 @@ const Editor = ({navigation}) => {title = null;timestamp = null;content = null;-handleBack.remove();handleBack = null;};@@ -245,26 +245,15 @@ const Editor = ({navigation}) => {}, []);useEffect(() => {- DeviceEventEmitter.emit('hide');-- return () => {- DeviceEventEmitter.emit('show');- };- }, []);-- useEffect(() => {- null;-return () => {DDS.isTab ? SideMenuEvent.open() : null;-SideMenuEvent.enable();};});useEffect(() => {EditorWebView.reload();- }, [colors.bg]);+ }, [colors]);return DDS.isTab ? (<Viewdiff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.jsindex d96df918c..940ad6a6c 100644--- a/apps/mobile/src/views/Folders/index.js+++ b/apps/mobile/src/views/Folders/index.js@@ -158,51 +158,9 @@ export const Folders = ({navigation}) => {ListHeaderComponent={<Viewstyle={{- marginTop: margin + 20,- flexDirection: 'row',- justifyContent: 'space-between',- width:- numColumns === 2- ? DDS.isTab- ? w * 0.7 * 0.95- : w * 0.95- : w * 0.95,-- alignSelf: 'center',- marginLeft:- numColumns === 2 ? (DDS.isTab ? w * 0.7 * 0.025 : 0) : 0,- paddingHorizontal: ph + 5,- }}>- <View>- <Text- transition="marginTop"- delay={200}- duration={200}- style={{- fontSize: SIZE.lg,- fontFamily: WEIGHT.medium,- color: colors.pri,- paddingHorizontal: DDS.isTab ? '2.5%' : '5%',- maxWidth: '100%',- }}>- <Text- style={{- color: colors.accent,- }}></Text>- </Text>- </View>-- <TouchableOpacity- onPress={() => {- setNumColumns(numColumns === 1 ? 2 : 1);- }}- style={{- justifyContent: 'center',- alignItems: 'center',- }}>- <Icon name="list" size={SIZE.xl} color={colors.icon} />- </TouchableOpacity>- </View>+ marginTop: margin,+ }}+ />}numColumns={numColumns}key={numColumns}