Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

refactoring

ammarahm-edff9cbdf4af41
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 9a34f1f51..4f11404cf 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -26,7 +26,6 @@ import {
} from './src/common/common';
export const DDS = new DeviceDetectionService();
-
export const db = new Storage(StorageInterface);
const App = () => {
diff --git a/apps/mobile/src/components/ListPlaceholders/index.js b/apps/mobile/src/components/ListPlaceholders/index.js
new file mode 100644
index 000000000..15da65315
--- /dev/null
+++ b/apps/mobile/src/components/ListPlaceholders/index.js
@@ -0,0 +1,672 @@
+import React from 'react';
+import {View, Text} from 'react-native';
+import Icon from 'react-native-vector-icons/Feather';
+import * as Animatable from 'react-native-animatable';
+
+import {
+ deleteItems,
+ rotate,
+ opacity,
+ slideLeft,
+ slideRight,
+} from '../../utils/animations';
+import {w} from '../../utils/utils';
+import {SIZE} from '../../common/common';
+
+export const NotebookPlaceHolder = ({colors, animation}) => {
+ return (
+ <Animatable.View
+ animation={animation}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ <View
+ style={{
+ width: '50%',
+ height: 15,
+ borderRadius: 100,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+
+ marginBottom: 8,
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '30%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginRight: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '30%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginRight: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '30%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginRight: 8,
+ }}
+ />
+ </View>
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ );
+};
+
+export const NotesPlaceHolder = ({colors, animation}) => {
+ return (
+ <Animatable.View
+ animation={animation}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ backgroundColor: colors.shade,
+ width: '50%',
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ <View
+ style={{
+ width: '90%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ width: '70%',
+ height: 10,
+ borderRadius: 5,
+ backgroundColor: colors.accent,
+ marginBottom: 8,
+ }}
+ />
+ <View
+ style={{
+ flexDirection: 'row',
+ }}>
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ marginRight: '5%',
+ }}
+ />
+ <View
+ style={{
+ width: '15%',
+ height: 8,
+ borderRadius: 5,
+ backgroundColor: colors.icon,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ );
+};
+
+export const TrashPlaceHolder = ({colors, animation}) => {
+ return (
+ <View
+ style={{
+ alignItems: 'center',
+ }}>
+ <Animatable.View
+ animation={deleteItems(-50, -100)}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={4500}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ width: 30,
+ height: 30,
+ backgroundColor: colors.errorBg,
+ borderRadius: 5,
+ transform: [
+ {
+ translateX: -50,
+ },
+ {
+ translateY: -100,
+ },
+ ],
+ }}
+ />
+ <Animatable.View
+ animation={deleteItems(-80, -70)}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={4500}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ width: 25,
+ height: 25,
+ backgroundColor: colors.errorBg,
+ borderRadius: 5,
+ transform: [
+ {
+ translateX: -80,
+ },
+ {
+ translateY: -70,
+ },
+ ],
+ }}
+ />
+ <Animatable.View
+ animation={deleteItems(-120, -50)}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={4500}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ width: 40,
+ height: 40,
+ backgroundColor: colors.errorBg,
+ borderRadius: 5,
+ transform: [
+ {
+ translateX: -120,
+ },
+ {
+ translateY: -50,
+ },
+ ],
+ }}
+ />
+
+ <Animatable.View
+ animation={deleteItems(-120, -140)}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={4500}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ width: 20,
+ height: 20,
+ backgroundColor: colors.errorBg,
+ borderRadius: 5,
+ transform: [
+ {
+ translateX: -120,
+ },
+ {
+ translateY: -140,
+ },
+ ],
+ }}
+ />
+
+ <Animatable.View
+ animation={rotate}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={3500}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ width: 100,
+ height: 15,
+ backgroundColor: colors.accent,
+ borderRadius: 100,
+ marginBottom: 2,
+ alignItems: 'center',
+ zIndex: 10,
+ }}>
+ <View
+ style={{
+ width: 25,
+ height: 10,
+ backgroundColor: colors.accent,
+ borderTopRightRadius: 5,
+ borderTopLeftRadius: 5,
+ marginBottom: 2,
+ marginTop: -9,
+ }}
+ />
+ </Animatable.View>
+
+ <View
+ style={{
+ backgroundColor: 'white',
+ }}>
+ <View
+ style={{
+ width: 80,
+ height: 100,
+ backgroundColor: colors.shade,
+ borderRadius: 5,
+ zIndex: 10,
+ }}>
+ <Animatable.View
+ animation={opacity}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={4500}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ flexDirection: 'row',
+ width: '90%',
+ alignSelf: 'center',
+ justifyContent: 'space-around',
+ alignItems: 'center',
+ height: '100%',
+ }}>
+ <View
+ style={{
+ width: 12,
+ height: 80,
+ backgroundColor: colors.accent,
+ borderRadius: 5,
+ zIndex: 10,
+ }}
+ />
+ <View
+ style={{
+ width: 12,
+ height: 80,
+ backgroundColor: colors.accent,
+ borderRadius: 5,
+ zIndex: 10,
+ }}
+ />
+ <View
+ style={{
+ width: 12,
+ height: 80,
+ backgroundColor: colors.accent,
+ borderRadius: 5,
+ zIndex: 10,
+ }}
+ />
+ </Animatable.View>
+ </View>
+ </View>
+ </View>
+ );
+};
+
+export const FavoritesPlaceHolder = ({colors, animation}) => {
+ return (
+ <View
+ style={{
+ flexDirection: 'row',
+ alignSelf: 'center',
+ justifyContent: 'space-around',
+ }}>
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ <Icon name="star" size={SIZE.xl} color="orange" />
+ </Animatable.View>
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ marginTop: -30,
+ }}>
+ <Icon name="star" size={SIZE.xxl} color="orange" />
+ </Animatable.View>
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ padding: 5,
+ borderRadius: 5,
+ marginBottom: 10,
+ }}>
+ <Icon name="star" size={SIZE.xl} color="orange" />
+ </Animatable.View>
+ </View>
+ );
+};
+
+export const TagsPlaceHolder = ({colors, animation}) => {
+ return (
+ <View
+ style={{
+ width: w * 0.6,
+ height: 200,
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}>
+ <Animatable.View
+ animation={slideRight}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ position: 'absolute',
+ left: 50,
+ top: 60,
+ }}>
+ <View
+ style={{
+ backgroundColor: colors.shade,
+
+ borderRadius: 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ padding: 4,
+ }}>
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.sm,
+ }}>
+ #
+ </Text>
+ <View
+ style={{
+ width: 40,
+ backgroundColor: colors.accent,
+ height: 12,
+ borderRadius: 100,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ position: 'absolute',
+ left: 70,
+ top: 100,
+ }}>
+ <View
+ style={{
+ backgroundColor: colors.shade,
+
+ borderRadius: 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ padding: 4,
+ }}>
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.sm,
+ }}>
+ #
+ </Text>
+ <View
+ style={{
+ width: 40,
+ backgroundColor: colors.accent,
+ height: 12,
+ borderRadius: 100,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ <Animatable.View
+ animation={slideRight}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ position: 'absolute',
+ left: 120,
+ top: 60,
+ }}>
+ <View
+ style={{
+ backgroundColor: colors.shade,
+
+ borderRadius: 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ padding: 4,
+ }}>
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.sm,
+ }}>
+ #
+ </Text>
+ <View
+ style={{
+ width: 40,
+ backgroundColor: colors.accent,
+ height: 12,
+ borderRadius: 100,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ position: 'absolute',
+ left: 140,
+ top: 100,
+ }}>
+ <View
+ style={{
+ backgroundColor: colors.shade,
+
+ borderRadius: 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ padding: 4,
+ }}>
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.sm,
+ }}>
+ #
+ </Text>
+ <View
+ style={{
+ width: 40,
+ backgroundColor: colors.accent,
+ height: 12,
+ borderRadius: 100,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ <Animatable.View
+ animation={slideRight}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ position: 'absolute',
+ left: 50,
+ top: 140,
+ }}>
+ <View
+ style={{
+ backgroundColor: colors.shade,
+
+ borderRadius: 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ padding: 4,
+ }}>
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.sm,
+ }}>
+ #
+ </Text>
+ <View
+ style={{
+ width: 40,
+ backgroundColor: colors.accent,
+ height: 12,
+ borderRadius: 100,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ <Animatable.View
+ animation={slideLeft}
+ iterationCount="infinite"
+ duration={3000}
+ iterationDelay={0}
+ direction="alternate"
+ easing="ease-in"
+ useNativeDriver={true}
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ position: 'absolute',
+ left: 120,
+ top: 140,
+ }}>
+ <View
+ style={{
+ backgroundColor: colors.shade,
+
+ borderRadius: 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ padding: 4,
+ }}>
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.sm,
+ }}>
+ #
+ </Text>
+ <View
+ style={{
+ width: 40,
+ backgroundColor: colors.accent,
+ height: 12,
+ borderRadius: 100,
+ }}
+ />
+ </View>
+ </Animatable.View>
+ </View>
+ );
+};
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index 8c7855b47..2253fe037 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -64,6 +64,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
func: () =>
NavigationService.push('Folders', {
title: 'Notebooks',
+ canGoBack: false,
}),
close: true,
},
@@ -119,7 +120,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
keyExtractor={(item, index) => item.name}
renderItem={({item, index}) => (
<TouchableOpacity
- activeOpacity={opacity}
+ activeOpacity={opacity / 2}
onPress={() => {
item.close === false ? null : close();
@@ -170,6 +171,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
/>
<TouchableOpacity
+ activeOpacity={opacity / 2}
onPress={() => {
close();
NavigationService.navigate('Tags');
@@ -225,6 +227,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
'water',
].map(item => (
<TouchableOpacity
+ activeOpacity={opacity / 2}
onPress={() => {
close();
NavigationService.navigate('Notes', {
@@ -260,6 +263,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
{['red', 'yellow', 'green', 'blue', 'purple', 'orange', 'gray'].map(
item => (
<TouchableOpacity
+ activeOpacity={opacity / 2}
style={{
flexDirection: 'row',
justifyContent: 'flex-start',
@@ -329,7 +333,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
NavigationService.navigate('Login');
}}
- activeOpacity={opacity}
+ activeOpacity={opacity / 2}
style={{
paddingVertical: pv + 5,
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 6e5230c19..107bd807f 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -396,9 +396,10 @@ const NoteItem = props => {
hideMenu();
NavigationService.push('Folders', {
note: item,
- title: 'Choose Notebook',
+ title: 'Choose a notebook',
isMove: true,
hideMore: true,
+ canGoBack: true,
});
}}
textStyle={{
@@ -430,7 +431,7 @@ const NoteItem = props => {
hideMenu();
}}
textStyle={{
- color: colors.pri,
+ color: colors.errorText,
fontFamily: WEIGHT.regular,
fontSize: SIZE.sm,
}}>
diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.js
index 0c15b154d..bc8dde73c 100644
--- a/apps/mobile/src/components/NotebookItem/index.js
+++ b/apps/mobile/src/components/NotebookItem/index.js
@@ -2,15 +2,7 @@ import React, {useState} from 'react';
import {View, Text, TouchableOpacity} from 'react-native';
import NavigationService from '../../services/NavigationService';
import Menu, {MenuItem, MenuDivider} from 'react-native-material-menu';
-import {
- COLOR_SCHEME,
- SIZE,
- ph,
- pv,
- opacity,
- WEIGHT,
- br,
-} from '../../common/common';
+import {SIZE, ph, pv, opacity, WEIGHT, br} from '../../common/common';
import Icon from 'react-native-vector-icons/Feather';
import {w, ToastEvent} from '../../utils/utils';
import {db, DDS} from '../../../App';
@@ -18,6 +10,7 @@ import {Dialog} from '../Dialog';
import {AddTopicDialog} from '../AddTopicDialog';
import {useAppContext} from '../../provider/useAppContext';
import {AddNotebookDialog} from '../AddNotebookDialog';
+
export const NotebookItem = ({
item,
index,
@@ -59,8 +52,7 @@ export const NotebookItem = ({
: NavigationService.navigate('Notebook', {
notebook: item,
note: noteToMove,
-
- title: hideMore ? 'Choose topic' : item.title,
+ title: hideMore ? 'Choose a topic' : item.title,
isMove: isMove ? true : false,
hideMore: hideMore ? true : false,
});
@@ -88,7 +80,7 @@ export const NotebookItem = ({
<View
style={{
marginHorizontal: '5%',
- paddingVertical: pv,
+ paddingVertical: isTopic ? pv / 2 : pv,
borderRadius: br,
justifyContent: 'flex-start',
alignItems: 'center',
@@ -130,7 +122,11 @@ export const NotebookItem = ({
alignItems: 'center',
width: '100%',
}}>
- <TouchableOpacity onPress={navigate}>
+ <TouchableOpacity
+ style={{
+ width: '75%',
+ }}
+ onPress={navigate}>
<Text
numberOfLines={1}
style={{
@@ -252,6 +248,20 @@ export const NotebookItem = ({
</Text>
</View>
)}
+ {isTopic ? (
+ <Text
+ style={{
+ color: colors.icon,
+ fontSize: SIZE.xxs,
+ textAlignVertical: 'center',
+ fontFamily: WEIGHT.regular,
+ marginTop: 5,
+ }}>
+ {item.totalNotes.length == 1
+ ? item.totalNotes + ' notes'
+ : item.totalNotes + ' note'}
+ </Text>
+ ) : null}
</TouchableOpacity>
{hideMore ? null : (
@@ -371,8 +381,7 @@ export const NotebookItem = ({
hideMenu();
}}
textStyle={{
- color: colors.pri,
-
+ color: colors.errorText,
fontFamily: WEIGHT.regular,
fontSize: SIZE.sm,
}}>
@@ -402,7 +411,13 @@ export const NotebookItem = ({
}
NavigationService.navigate('Home');
- ToastEvent.show(`Note moved to ${item.title}`, 'success', 3000);
+ ToastEvent.show(
+ `Note moved to ${item.title}`,
+ 'success',
+ 3000,
+ () => {},
+ '',
+ );
}}
style={{
borderWidth: 1,
@@ -410,7 +425,7 @@ export const NotebookItem = ({
width: '20%',
paddingHorizontal: ph - 5,
borderColor: colors.nav,
- paddingVertical: pv,
+ paddingVertical: pv - 5,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
@@ -418,8 +433,8 @@ export const NotebookItem = ({
}}>
<Text
style={{
- fontSize: SIZE.xs,
- fontFamily: WEIGHT.semibold,
+ fontSize: SIZE.sm,
+ fontFamily: WEIGHT.regular,
color: 'white',
}}>
Move
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index 0cdeb3514..81b5be2fc 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -13,6 +13,8 @@ import {DDS, db} from '../../../App';
import * as Animatable from 'react-native-animatable';
import {useAppContext} from '../../provider/useAppContext';
import Icon from 'react-native-vector-icons/Feather';
+import {NotesPlaceHolder} from '../ListPlaceholders';
+import {slideRight, slideLeft} from '../../utils/animations';
export const NotesList = ({
keyword = null,
notes,
@@ -27,28 +29,6 @@ export const NotesList = ({
const {colors} = useAppContext();
const [numColumns, setNumColumns] = useState(1);
const [pinned, setPinned] = useState([]);
- const slideRight = {
- 0: {
- transform: [{translateX: -4}],
- },
- 0.5: {
- transform: [{translateX: 0}],
- },
- 1: {
- transform: [{translateX: 4}],
- },
- };
- const slideLeft = {
- 0: {
- transform: [{translateX: 4}],
- },
- 0.5: {
- transform: [{translateX: 0}],
- },
- 1: {
- transform: [{translateX: -4}],
- },
- };
useEffect(() => {
let pinnedItems = db.getPinned();
@@ -79,203 +59,38 @@ export const NotesList = ({
onScroll(y);
}}
ListEmptyComponent={
- <View
- style={{
- height: '80%',
- width: '100%',
- alignItems: 'center',
- alignSelf: 'center',
- justifyContent: 'center',
- opacity: 0.8,
- }}>
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <View
- style={{
- width: '90%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
-
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- easing="ease-in"
- iterationDelay={0}
- direction="alternate"
- useNativeDriver={true}
+ pinned && pinned.length > 0 ? null : (
+ <View
style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
+ height: '80%',
+ width: '100%',
+ alignItems: 'center',
+ alignSelf: 'center',
+ justifyContent: 'center',
+ opacity: 0.8,
}}>
- <View
- style={{
- width: '90%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
+ <NotesPlaceHolder animation={slideRight} colors={colors} />
+ <NotesPlaceHolder animation={slideLeft} colors={colors} />
+ <NotesPlaceHolder animation={slideRight} colors={colors} />
+ <Text
style={{
- flexDirection: 'row',
+ color: colors.icon,
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ marginTop: 20,
}}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
- <Animatable.View
- easing="ease-in"
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- useNativeDriver={true}
- iterationDelay={0}
- direction="alternate"
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <View
- style={{
- width: '90%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
+ Notes you write will appear here.
+ </Text>
+ <Text
style={{
- flexDirection: 'row',
+ fontSize: SIZE.sm,
+ color: colors.icon,
+ marginTop: 20,
}}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
-
- <Text
- style={{
- color: colors.icon,
- fontSize: SIZE.md,
- fontFamily: WEIGHT.regular,
- marginTop: 20,
- }}>
- Notes you write will appear here.
- </Text>
- <Text
- style={{
- fontSize: SIZE.sm,
- color: colors.icon,
- marginTop: 20,
- }}>
- No notes found
- </Text>
- </View>
+ No notes found
+ </Text>
+ </View>
+ )
}
ListHeaderComponent={
<View
@@ -289,7 +104,7 @@ export const NotesList = ({
? 175
: 175 - 60,
}}>
- {notes[0] ? (
+ {pinned && pinned.length > 0 ? (
<>
<FlatList
data={pinned}
diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.js
index 9ec947c36..54df9991c 100644
--- a/apps/mobile/src/components/header/index.js
+++ b/apps/mobile/src/components/header/index.js
@@ -46,10 +46,11 @@ export const Header = ({
NavigationService.goBack();
}}
style={{
- justifyContent: 'flex-start',
+ justifyContent: 'center',
alignItems: 'flex-start',
height: 40,
- width: 25,
+ width: 50,
+ marginTop: 2.5,
}}>
<Icon
style={{
@@ -57,7 +58,7 @@ export const Header = ({
}}
color={colors.pri}
name={'chevron-left'}
- size={SIZE.xxxl}
+ size={SIZE.xxxl - 3}
/>
</TouchableOpacity>
) : (
diff --git a/apps/mobile/src/utils/animations.js b/apps/mobile/src/utils/animations.js
new file mode 100644
index 000000000..85329b143
--- /dev/null
+++ b/apps/mobile/src/utils/animations.js
@@ -0,0 +1,61 @@
+export const slideRight = {
+ 0: {
+ transform: [{translateX: -4}],
+ },
+ 0.5: {
+ transform: [{translateX: 0}],
+ },
+ 1: {
+ transform: [{translateX: 4}],
+ },
+};
+export const slideLeft = {
+ 0: {
+ transform: [{translateX: 4}],
+ },
+ 0.5: {
+ transform: [{translateX: 0}],
+ },
+ 1: {
+ transform: [{translateX: -4}],
+ },
+};
+
+export const rotate = {
+ 0: {
+ transform: [{rotateZ: '0deg'}, {translateX: 0}, {translateY: 0}],
+ },
+ 0.5: {
+ transform: [{rotateZ: '25deg'}, {translateX: 10}, {translateY: -20}],
+ },
+ 1: {
+ transform: [{rotateZ: '45deg'}, {translateX: 10}, {translateY: -20}],
+ },
+};
+
+export const deleteItems = (tX, tY) => {
+ return {
+ 0: {
+ transform: [{translateX: tX}, {translateY: tY}],
+ },
+ 0.3: {
+ transform: [{translateX: 0}, {translateY: 0}],
+ },
+ 0.5: {
+ transform: [{translateX: 0}, {translateY: 50}],
+ },
+ 1: {
+ transform: [{translateX: 0}, {translateY: 110}],
+ },
+ };
+};
+
+export const opacity = {
+ 0: {
+ opacity: 0,
+ },
+
+ 1: {
+ opacity: 1,
+ },
+};
diff --git a/apps/mobile/src/views/AccountSettings/index.js b/apps/mobile/src/views/AccountSettings/index.js
index 79a6a6082..57095c7ad 100644
--- a/apps/mobile/src/views/AccountSettings/index.js
+++ b/apps/mobile/src/views/AccountSettings/index.js
@@ -1,52 +1,13 @@
-import React, {useEffect, useState} from 'react';
-import {
- ScrollView,
- View,
- Text,
- TouchableOpacity,
- Dimensions,
- Image,
- SafeAreaView,
- Platform,
- FlatList,
-} from 'react-native';
-import NavigationService from '../../services/NavigationService';
-import {
- COLOR_SCHEME,
- SIZE,
- br,
- ph,
- pv,
- opacity,
- FONT,
- WEIGHT,
- onThemeUpdate,
- clearThemeUpdateListener,
-} from '../../common/common';
-import Icon from 'react-native-vector-icons/Feather';
-import {Reminder} from '../../components/Reminder';
-import {ListItem} from '../../components/ListItem';
+import React from 'react';
+import {View, Text, TouchableOpacity, Image, FlatList} from 'react-native';
+import {SIZE, pv, opacity, WEIGHT} from '../../common/common';
import {Header} from '../../components/header';
-import NoteItem from '../../components/NoteItem';
-import {useForceUpdate} from '../ListsEditor';
import {AnimatedSafeAreaView} from '../Home';
-
-const w = Dimensions.get('window').width;
-const h = Dimensions.get('window').height;
+import {useAppContext} from '../../provider/useAppContext';
export const AccountSettings = ({navigation}) => {
- const [colors, setColors] = useState(COLOR_SCHEME);
- const forceUpdate = useForceUpdate();
- useEffect(() => {
- onThemeUpdate(() => {
- forceUpdate();
- });
- return () => {
- clearThemeUpdateListener(() => {
- forceUpdate();
- });
- };
- }, []);
+ const {colors} = useAppContext();
+
return (
<AnimatedSafeAreaView
transition="backgroundColor"
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index 388cd933a..eed367130 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -13,7 +13,6 @@ import {
import {SIZE, WEIGHT} from '../../common/common';
import WebView from 'react-native-webview';
import Icon from 'react-native-vector-icons/Feather';
-
import {db} from '../../../App';
import {SideMenuEvent} from '../../utils/utils';
import {Dialog} from '../../components/Dialog';
diff --git a/apps/mobile/src/views/Favorites/index.js b/apps/mobile/src/views/Favorites/index.js
index 14cba7c92..6b8dac103 100644
--- a/apps/mobile/src/views/Favorites/index.js
+++ b/apps/mobile/src/views/Favorites/index.js
@@ -1,25 +1,22 @@
import React, {useEffect, useState} from 'react';
import {
- Dimensions,
KeyboardAvoidingView,
View,
Text,
FlatList,
Platform,
} from 'react-native';
-
import {Header} from '../../components/header';
import {AnimatedSafeAreaView} from '../Home';
import {useAppContext} from '../../provider/useAppContext';
import * as Animatable from 'react-native-animatable';
import {Search} from '../../components/SearchInput';
import {db} from '../../../App';
-import Icon from 'react-native-vector-icons/Feather';
+
import {SIZE, WEIGHT} from '../../common/common';
import NoteItem from '../../components/NoteItem';
import {NotebookItem} from '../../components/NotebookItem';
-const w = Dimensions.get('window').width;
-const h = Dimensions.get('window').height;
+import {FavoritesPlaceHolder} from '../../components/ListPlaceholders';
export const Favorites = ({navigation}) => {
// Global State
@@ -156,59 +153,7 @@ export const Favorites = ({navigation}) => {
justifyContent: 'center',
opacity: 0.8,
}}>
- <View
- style={{
- flexDirection: 'row',
- alignSelf: 'center',
- justifyContent: 'space-around',
- }}>
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <Icon name="star" size={SIZE.xl} color="orange" />
- </Animatable.View>
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- marginTop: -30,
- }}>
- <Icon name="star" size={SIZE.xxl} color="orange" />
- </Animatable.View>
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <Icon name="star" size={SIZE.xl} color="orange" />
- </Animatable.View>
- </View>
+ <FavoritesPlaceHolder />
<Text
style={{
color: colors.pri,
diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.js
index 374f31f20..75b9b1864 100644
--- a/apps/mobile/src/views/Folders/index.js
+++ b/apps/mobile/src/views/Folders/index.js
@@ -1,44 +1,25 @@
import React, {useEffect, useState} from 'react';
import {
- ScrollView,
View,
Text,
TouchableOpacity,
- Dimensions,
- Image,
- SafeAreaView,
Platform,
- Modal,
KeyboardAvoidingView,
+ FlatList,
} from 'react-native';
-import NavigationService from '../../services/NavigationService';
-import {
- COLOR_SCHEME,
- SIZE,
- br,
- ph,
- pv,
- opacity,
- FONT,
- WEIGHT,
- onThemeUpdate,
- clearThemeUpdateListener,
-} from '../../common/common';
+import {SIZE, ph, pv, opacity, WEIGHT} from '../../common/common';
import Icon from 'react-native-vector-icons/Feather';
-import {Reminder} from '../../components/Reminder';
-import {ListItem} from '../../components/ListItem';
-import {getElevation, h, w, timeSince} from '../../utils/utils';
-import {FlatList, TextInput} from 'react-native-gesture-handler';
-import {useForceUpdate} from '../ListsEditor';
import {AddNotebookDialog} from '../../components/AddNotebookDialog';
import {NotebookItem} from '../../components/NotebookItem';
import {Search} from '../../components/SearchInput';
-import {db, DDS} from '../../../App';
+import {db} from '../../../App';
import {Header} from '../../components/header';
import {AnimatedSafeAreaView} from '../Home';
import * as Animatable from 'react-native-animatable';
import {NavigationEvents} from 'react-navigation';
import {useAppContext} from '../../provider/useAppContext';
+import {NotebookPlaceHolder} from '../../components/ListPlaceholders';
+import {slideRight, slideLeft} from '../../utils/animations';
export const Folders = ({navigation}) => {
const {colors} = useAppContext();
@@ -57,43 +38,6 @@ export const Folders = ({navigation}) => {
let searchHeight = 0;
let marginSet = false;
- const slideRight = {
- 0: {
- transform: [{translateX: -4}],
- },
- 0.5: {
- transform: [{translateX: 0}],
- },
- 1: {
- transform: [{translateX: 4}],
- },
- };
- const slideLeft = {
- 0: {
- transform: [{translateX: 4}],
- },
- 0.5: {
- transform: [{translateX: 0}],
- },
- 1: {
- transform: [{translateX: -4}],
- },
- };
-
- const setMarginTop = () => {
- return;
- if (headerHeight < 30 || searchHeight < 30) {
- return;
- }
- let toAdd = h * 0.06;
- if (marginSet) return;
- let a = headerHeight + searchHeight + toAdd;
- setMargin(a);
- headerHeight = 0;
- searchHeight = 0;
- marginSet = true;
- };
-
useEffect(() => {
setNotebooks(db.getNotebooks());
console.log(db.getNotebooks());
@@ -135,9 +79,8 @@ export const Folders = ({navigation}) => {
width: '100%',
}}>
<Header
- sendHeight={height => (headerHeight = height)}
hide={hideHeader}
- menu={true}
+ menu={params.canGoBack ? false : true}
showSearch={() => {
setHideHeader(false);
countUp = 0;
@@ -145,18 +88,10 @@ export const Folders = ({navigation}) => {
}}
colors={colors}
heading={params.title}
- canGoBack={false}
+ canGoBack={params.canGoBack}
/>
{notebooks.length == 0 ? null : (
- <Search
- sendHeight={height => {
- searchHeight = height;
- console.log(searchHeight + '' + headerHeight);
- setMarginTop();
- }}
- placeholder="Search your notebook"
- hide={hideHeader}
- />
+ <Search placeholder="Search your notebook" hide={hideHeader} />
)}
</Animatable.View>
@@ -184,7 +119,7 @@ export const Folders = ({navigation}) => {
ListHeaderComponent={
<View
style={{
- marginTop: Platform.OS == 'ios' ? 145 : 185,
+ marginTop: Platform.OS == 'ios' ? 135 : 175,
}}
/>
}
@@ -200,257 +135,9 @@ export const Folders = ({navigation}) => {
justifyContent: 'center',
opacity: 0.8,
}}>
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <View
- style={{
- width: '50%',
- height: 15,
- borderRadius: 100,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
-
- marginBottom: 8,
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- </View>
- <View
- style={{
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
-
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <View
- style={{
- width: '50%',
- height: 15,
- borderRadius: 100,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
-
- marginBottom: 8,
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- </View>
- <View
- style={{
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
-
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <View
- style={{
- width: '50%',
- height: 15,
- borderRadius: 100,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
-
- marginBottom: 8,
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- </View>
- <View
- style={{
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
+ <NotebookPlaceHolder animation={slideRight} colors={colors} />
+ <NotebookPlaceHolder animation={slideLeft} colors={colors} />
+ <NotebookPlaceHolder animation={slideRight} colors={colors} />
<Text
style={{
diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.js
index 93226d6b3..39be4d9c8 100644
--- a/apps/mobile/src/views/Login/index.js
+++ b/apps/mobile/src/views/Login/index.js
@@ -1,36 +1,17 @@
import React, {useEffect, useState, createRef} from 'react';
import {
- ScrollView,
View,
Text,
TouchableOpacity,
- Dimensions,
- Image,
SafeAreaView,
- Platform,
DeviceEventEmitter,
} from 'react-native';
import NavigationService from '../../services/NavigationService';
-import {
- COLOR_SCHEME,
- SIZE,
- br,
- ph,
- pv,
- opacity,
- FONT,
- WEIGHT,
- clearThemeUpdateListener,
- onThemeUpdate,
-} from '../../common/common';
-import Icon from 'react-native-vector-icons/Feather';
-import {Reminder} from '../../components/Reminder';
-import {ListItem} from '../../components/ListItem';
-import {getElevation} from '../../utils/utils';
-import {FlatList, TextInput} from 'react-native-gesture-handler';
+import {SIZE, pv, opacity, WEIGHT} from '../../common/common';
+
+import {TextInput} from 'react-native-gesture-handler';
import {NavigationEvents} from 'react-navigation';
import {Header} from '../../components/header';
-import {useForceUpdate} from '../ListsEditor';
import {DDS} from '../../../App';
import {useAppContext} from '../../provider/useAppContext';
export const Login = ({navigation}) => {
diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.js
index 6debd4e66..a23c4a271 100644
--- a/apps/mobile/src/views/Notebook/index.js
+++ b/apps/mobile/src/views/Notebook/index.js
@@ -1,34 +1,15 @@
-import React, {useEffect, useState} from 'react';
+import React, {useState} from 'react';
import {
- ScrollView,
View,
Text,
TouchableOpacity,
- Dimensions,
- Image,
- SafeAreaView,
Platform,
FlatList,
KeyboardAvoidingView,
} from 'react-native';
-import NavigationService from '../../services/NavigationService';
-import {
- COLOR_SCHEME,
- SIZE,
- br,
- ph,
- pv,
- opacity,
- FONT,
- WEIGHT,
- onThemeUpdate,
- clearThemeUpdateListener,
-} from '../../common/common';
+import {SIZE, ph, pv, opacity, WEIGHT} from '../../common/common';
import Icon from 'react-native-vector-icons/Feather';
-import {Reminder} from '../../components/Reminder';
-import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header';
-import NoteItem from '../../components/NoteItem';
import {NotebookItem} from '../../components/NotebookItem';
import {Search} from '../../components/SearchInput';
import {useForceUpdate} from '../ListsEditor';
@@ -36,19 +17,13 @@ import {AddTopicDialog} from '../../components/AddTopicDialog';
import {AnimatedSafeAreaView} from '../Home';
import * as Animatable from 'react-native-animatable';
import {NavigationEvents} from 'react-navigation';
-import {DDS} from '../../../App';
import {useAppContext} from '../../provider/useAppContext';
-const w = Dimensions.get('window').width;
-const h = Dimensions.get('window').height;
-const AnimatedTouchableOpacity = Animatable.createAnimatableComponent(
- TouchableOpacity,
-);
+
export const Notebook = ({navigation}) => {
// State
const {colors} = useAppContext();
const params = navigation.state.params;
const [hideHeader, setHideHeader] = useState(false);
- const [margin, setMargin] = useState(180);
const [buttonHide, setButtonHide] = useState(false);
const [numColumns, setNumColumns] = useState(1);
const [addTopic, setAddTopic] = useState(false);
@@ -57,27 +32,10 @@ export const Notebook = ({navigation}) => {
let offsetY = 0;
let countUp = 0;
let countDown = 0;
- let headerHeight = 0;
- let searchHeight = 0;
- let marginSet = false;
// Effects
// Functions
- const setMarginTop = () => {
- return;
- console.log(params.notebook);
- if (headerHeight < 30 || searchHeight < 30) {
- return;
- }
- let toAdd = h * 0.06;
- if (marginSet) return;
- let a = headerHeight + searchHeight + toAdd;
- setMargin(a);
- headerHeight = 0;
- searchHeight = 0;
- marginSet = true;
- };
// Render
return (
@@ -114,7 +72,6 @@ export const Notebook = ({navigation}) => {
width: '100%',
}}>
<Header
- sendHeight={height => (headerHeight = height)}
hide={hideHeader}
showSearch={() => {
setHideHeader(false);
@@ -126,14 +83,7 @@ export const Notebook = ({navigation}) => {
canGoBack={true}
/>
- <Search
- sendHeight={height => {
- searchHeight = height;
- setMarginTop();
- }}
- placeholder={`Search in ${params.title}`}
- hide={hideHeader}
- />
+ <Search placeholder={`Search in ${params.title}`} hide={hideHeader} />
</Animatable.View>
<FlatList
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index 540c70489..cb7a7f006 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -1,31 +1,20 @@
import React, {useEffect, useState} from 'react';
import {
- ScrollView,
- View,
Text,
TouchableOpacity,
Dimensions,
- Image,
- SafeAreaView,
- Platform,
KeyboardAvoidingView,
} from 'react-native';
-import NavigationService from '../../services/NavigationService';
import {
- COLOR_SCHEME,
SIZE,
- br,
ph,
pv,
opacity,
- FONT,
WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common';
import Icon from 'react-native-vector-icons/Feather';
-import {Reminder} from '../../components/Reminder';
-import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header';
import {Search} from '../../components/SearchInput';
import {useForceUpdate} from '../ListsEditor';
@@ -34,8 +23,6 @@ import {AnimatedSafeAreaView} from '../Home';
import {db} from '../../../App';
import * as Animatable from 'react-native-animatable';
import {useAppContext} from '../../provider/useAppContext';
-const w = Dimensions.get('window').width;
-const h = Dimensions.get('window').height;
export const Notes = ({navigation}) => {
const {colors} = useAppContext();
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 537b46de1..767132ef8 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -9,11 +9,8 @@ import {
import NavigationService from '../../services/NavigationService';
import {
SIZE,
- br,
- ph,
pv,
opacity,
- FONT,
WEIGHT,
COLOR_SCHEME_DARK,
COLOR_SCHEME_LIGHT,
@@ -25,9 +22,6 @@ import AsyncStorage from '@react-native-community/async-storage';
import {AnimatedSafeAreaView} from '../Home';
import {useAppContext} from '../../provider/useAppContext';
-const w = Dimensions.get('window').width;
-const h = Dimensions.get('window').height;
-
export const Settings = ({navigation}) => {
const {colors, changeAccentColor, changeColorScheme} = useAppContext();
return (
diff --git a/apps/mobile/src/views/Signup/index.js b/apps/mobile/src/views/Signup/index.js
index 78f9593f4..f608f4c43 100644
--- a/apps/mobile/src/views/Signup/index.js
+++ b/apps/mobile/src/views/Signup/index.js
@@ -1,38 +1,18 @@
import React, {useEffect, useState, createRef} from 'react';
import {
- ScrollView,
View,
Text,
TouchableOpacity,
- Dimensions,
- Image,
SafeAreaView,
- Platform,
DeviceEventEmitter,
} from 'react-native';
-import NavigationService from '../../services/NavigationService';
-import {
- COLOR_SCHEME,
- SIZE,
- br,
- ph,
- pv,
- opacity,
- FONT,
- WEIGHT,
- onThemeUpdate,
- clearThemeUpdateListener,
-} from '../../common/common';
-import Icon from 'react-native-vector-icons/Ionicons';
-import {Reminder} from '../../components/Reminder';
-import {ListItem} from '../../components/ListItem';
-import {getElevation} from '../../utils/utils';
-import {FlatList, TextInput} from 'react-native-gesture-handler';
+import {SIZE, pv, opacity, WEIGHT} from '../../common/common';
+import {TextInput} from 'react-native-gesture-handler';
import {NavigationEvents} from 'react-navigation';
import {Header} from '../../components/header';
-import {useForceUpdate} from '../ListsEditor';
import {DDS} from '../../../App';
import {useAppContext} from '../../provider/useAppContext';
+
export const Signup = ({navigation}) => {
const {colors} = useAppContext();
useEffect(() => {
diff --git a/apps/mobile/src/views/Tags/index.js b/apps/mobile/src/views/Tags/index.js
index d6de93c23..698d6d267 100644
--- a/apps/mobile/src/views/Tags/index.js
+++ b/apps/mobile/src/views/Tags/index.js
@@ -4,34 +4,12 @@ import {View, Text, Dimensions, SafeAreaView, FlatList} from 'react-native';
import {SIZE, pv, WEIGHT} from '../../common/common';
import {Header} from '../../components/header';
import {useAppContext} from '../../provider/useAppContext';
-import * as Animatable from 'react-native-animatable';
+import {TagsPlaceHolder} from '../../components/ListPlaceholders';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
export const Tags = ({navigation}) => {
const {colors} = useAppContext();
- const slideRight = {
- 0: {
- transform: [{scale: 1}, {translateX: -2}],
- },
- 0.5: {
- transform: [{scale: 0.98}, {translateX: 0}],
- },
- 1: {
- transform: [{scale: 1.02}, {translateX: 2}],
- },
- };
- const slideLeft = {
- 0: {
- transform: [{scale: 1.02}, {translateX: 2}],
- },
- 0.5: {
- transform: [{scale: 0.98}, {translateX: 0}],
- },
- 1: {
- transform: [{scale: 1}, {translateX: -2}],
- },
- };
return (
<SafeAreaView
@@ -60,261 +38,7 @@ export const Tags = ({navigation}) => {
justifyContent: 'center',
opacity: 0.8,
}}>
- <View
- style={{
- width: w * 0.6,
- height: 200,
-
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- position: 'absolute',
- left: 50,
- top: 60,
- }}>
- <View
- style={{
- backgroundColor: colors.shade,
-
- borderRadius: 5,
- flexDirection: 'row',
- alignItems: 'center',
- padding: 4,
- }}>
- <Text
- style={{
- color: colors.accent,
- fontSize: SIZE.sm,
- }}>
- #
- </Text>
- <View
- style={{
- width: 40,
- backgroundColor: colors.accent,
- height: 12,
- borderRadius: 100,
- }}
- />
- </View>
- </Animatable.View>
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- position: 'absolute',
- left: 70,
- top: 100,
- }}>
- <View
- style={{
- backgroundColor: colors.shade,
-
- borderRadius: 5,
- flexDirection: 'row',
- alignItems: 'center',
- padding: 4,
- }}>
- <Text
- style={{
- color: colors.accent,
- fontSize: SIZE.sm,
- }}>
- #
- </Text>
- <View
- style={{
- width: 40,
- backgroundColor: colors.accent,
- height: 12,
- borderRadius: 100,
- }}
- />
- </View>
- </Animatable.View>
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- position: 'absolute',
- left: 120,
- top: 60,
- }}>
- <View
- style={{
- backgroundColor: colors.shade,
-
- borderRadius: 5,
- flexDirection: 'row',
- alignItems: 'center',
- padding: 4,
- }}>
- <Text
- style={{
- color: colors.accent,
- fontSize: SIZE.sm,
- }}>
- #
- </Text>
- <View
- style={{
- width: 40,
- backgroundColor: colors.accent,
- height: 12,
- borderRadius: 100,
- }}
- />
- </View>
- </Animatable.View>
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- position: 'absolute',
- left: 140,
- top: 100,
- }}>
- <View
- style={{
- backgroundColor: colors.shade,
-
- borderRadius: 5,
- flexDirection: 'row',
- alignItems: 'center',
- padding: 4,
- }}>
- <Text
- style={{
- color: colors.accent,
- fontSize: SIZE.sm,
- }}>
- #
- </Text>
- <View
- style={{
- width: 40,
- backgroundColor: colors.accent,
- height: 12,
- borderRadius: 100,
- }}
- />
- </View>
- </Animatable.View>
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- position: 'absolute',
- left: 50,
- top: 140,
- }}>
- <View
- style={{
- backgroundColor: colors.shade,
-
- borderRadius: 5,
- flexDirection: 'row',
- alignItems: 'center',
- padding: 4,
- }}>
- <Text
- style={{
- color: colors.accent,
- fontSize: SIZE.sm,
- }}>
- #
- </Text>
- <View
- style={{
- width: 40,
- backgroundColor: colors.accent,
- height: 12,
- borderRadius: 100,
- }}
- />
- </View>
- </Animatable.View>
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- flexDirection: 'row',
- alignItems: 'center',
- position: 'absolute',
- left: 120,
- top: 140,
- }}>
- <View
- style={{
- backgroundColor: colors.shade,
-
- borderRadius: 5,
- flexDirection: 'row',
- alignItems: 'center',
- padding: 4,
- }}>
- <Text
- style={{
- color: colors.accent,
- fontSize: SIZE.sm,
- }}>
- #
- </Text>
- <View
- style={{
- width: 40,
- backgroundColor: colors.accent,
- height: 12,
- borderRadius: 100,
- }}
- />
- </View>
- </Animatable.View>
- </View>
+ <TagsPlaceHolder colors={colors} />
<Text
style={{
fontSize: SIZE.md,
diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.js
index 4477b9ead..4f6bb6d38 100644
--- a/apps/mobile/src/views/Trash/index.js
+++ b/apps/mobile/src/views/Trash/index.js
@@ -2,7 +2,6 @@ import React, {useEffect, useState} from 'react';
import {
Text,
TouchableOpacity,
- Dimensions,
SafeAreaView,
FlatList,
View,
@@ -16,7 +15,8 @@ import {db} from '../../../App';
import {NotebookItem} from '../../components/NotebookItem';
import {Dialog} from '../../components/Dialog';
import {ToastEvent} from '../../utils/utils';
-import * as Animatable from 'react-native-animatable';
+import {TrashPlaceHolder} from '../../components/ListPlaceholders';
+
export const Trash = ({navigation}) => {
const {colors} = useAppContext();
const [trash, setTrash] = useState([]);
@@ -26,45 +26,6 @@ export const Trash = ({navigation}) => {
setTrash([...allTrash]);
}, []);
- const rotate = {
- 0: {
- transform: [{rotateZ: '0deg'}, {translateX: 0}, {translateY: 0}],
- },
- 0.5: {
- transform: [{rotateZ: '25deg'}, {translateX: 10}, {translateY: -20}],
- },
- 1: {
- transform: [{rotateZ: '45deg'}, {translateX: 10}, {translateY: -20}],
- },
- };
-
- const deleteItems = (tX, tY) => {
- return {
- 0: {
- transform: [{translateX: tX}, {translateY: tY}],
- },
- 0.3: {
- transform: [{translateX: 0}, {translateY: 0}],
- },
- 0.5: {
- transform: [{translateX: 0}, {translateY: 50}],
- },
- 1: {
- transform: [{translateX: 0}, {translateY: 110}],
- },
- };
- };
-
- const opacity = {
- 0: {
- opacity: 0,
- },
-
- 1: {
- opacity: 1,
- },
- };
-
return (
<SafeAreaView
style={{
@@ -115,426 +76,7 @@ export const Trash = ({navigation}) => {
justifyContent: 'center',
opacity: 0.8,
}}>
- <View
- style={{
- alignItems: 'center',
- }}>
- <Animatable.View
- animation={deleteItems(-50, -100)}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={4500}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- width: 30,
- height: 30,
- backgroundColor: colors.errorBg,
- borderRadius: 5,
- transform: [
- {
- translateX: -50,
- },
- {
- translateY: -100,
- },
- ],
- }}
- />
- <Animatable.View
- animation={deleteItems(-80, -70)}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={4500}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- width: 25,
- height: 25,
- backgroundColor: colors.errorBg,
- borderRadius: 5,
- transform: [
- {
- translateX: -80,
- },
- {
- translateY: -70,
- },
- ],
- }}
- />
- <Animatable.View
- animation={deleteItems(-120, -50)}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={4500}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- width: 40,
- height: 40,
- backgroundColor: colors.errorBg,
- borderRadius: 5,
- transform: [
- {
- translateX: -120,
- },
- {
- translateY: -50,
- },
- ],
- }}
- />
-
- <Animatable.View
- animation={deleteItems(-120, -140)}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={4500}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- width: 20,
- height: 20,
- backgroundColor: colors.errorBg,
- borderRadius: 5,
- transform: [
- {
- translateX: -120,
- },
- {
- translateY: -140,
- },
- ],
- }}
- />
-
- <Animatable.View
- animation={rotate}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={3500}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- width: 100,
- height: 15,
- backgroundColor: colors.accent,
- borderRadius: 100,
- marginBottom: 2,
- alignItems: 'center',
- zIndex: 10,
- }}>
- <View
- style={{
- width: 25,
- height: 10,
- backgroundColor: colors.accent,
- borderTopRightRadius: 5,
- borderTopLeftRadius: 5,
- marginBottom: 2,
- marginTop: -9,
- }}
- />
- </Animatable.View>
-
- <View
- style={{
- backgroundColor: 'white',
- }}>
- <View
- style={{
- width: 80,
- height: 100,
- backgroundColor: colors.shade,
- borderRadius: 5,
- zIndex: 10,
- }}>
- <Animatable.View
- animation={opacity}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={4500}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- flexDirection: 'row',
- width: '90%',
- alignSelf: 'center',
- justifyContent: 'space-around',
- alignItems: 'center',
- height: '100%',
- }}>
- <View
- style={{
- width: 12,
- height: 80,
- backgroundColor: colors.accent,
- borderRadius: 5,
- zIndex: 10,
- }}
- />
- <View
- style={{
- width: 12,
- height: 80,
- backgroundColor: colors.accent,
- borderRadius: 5,
- zIndex: 10,
- }}
- />
- <View
- style={{
- width: 12,
- height: 80,
- backgroundColor: colors.accent,
- borderRadius: 5,
- zIndex: 10,
- }}
- />
- </Animatable.View>
- </View>
- </View>
- </View>
-
- {/*
-
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <Icon
- name="trash"
- size={SIZE.xl}
- color={colors.accent}
- style={{
- position: 'absolute',
- right: 5,
- bottom: 0,
- }}
- />
- <View
- style={{
- width: '90%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
-
- <Animatable.View
- animation={slideLeft}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <Icon
- name="trash"
- size={SIZE.xl}
- color={colors.accent}
- style={{
- position: 'absolute',
- right: 5,
- bottom: 0,
- }}
- />
- <View
- style={{
- width: '50%',
- height: 15,
- borderRadius: 100,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
-
- marginBottom: 8,
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- <View
- style={{
- width: '30%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginRight: 8,
- }}
- />
- </View>
- <View
- style={{
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
- <Animatable.View
- animation={slideRight}
- iterationCount="infinite"
- duration={3000}
- iterationDelay={0}
- direction="alternate"
- easing="ease-in"
- useNativeDriver={true}
- style={{
- backgroundColor: colors.shade,
- width: '50%',
- padding: 5,
- borderRadius: 5,
- marginBottom: 10,
- }}>
- <Icon
- name="trash"
- size={SIZE.xl}
- color={colors.accent}
- style={{
- position: 'absolute',
- right: 5,
- bottom: 0,
- }}
- />
- <View
- style={{
- width: '90%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- width: '70%',
- height: 10,
- borderRadius: 5,
- backgroundColor: colors.accent,
- marginBottom: 8,
- }}
- />
- <View
- style={{
- flexDirection: 'row',
- }}>
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- marginRight: '5%',
- }}
- />
- <View
- style={{
- width: '15%',
- height: 8,
- borderRadius: 5,
- backgroundColor: colors.icon,
- }}
- />
- </View>
- </Animatable.View>
-
-
- */}
-
+ <TrashPlaceHolder colors={colors} />
<Text
style={{
color: colors.icon,