Skip to content

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

refine animations

ammarahm-ed4b3554c8fa90
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 49cbaf89d..4f0738d03 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -173,7 +173,7 @@ const App = () => {
<Animatable.View
animation="fadeIn"
useNativeDriver={true}
- duration={300}
+ duration={500}
delay={450}
style={{
width: '4%',
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index b6b3ba8e5..e5639af53 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -1,15 +1,19 @@
import React, {useEffect} from 'react';
-import {FlatList, Platform, SectionList, Text, View} from 'react-native';
+import {
+ ActivityIndicator,
+ FlatList,
+ Platform,
+ SectionList,
+ Text,
+ View,
+} from 'react-native';
import {SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {slideLeft, slideRight} from '../../utils/animations';
-import {w} from '../../utils/utils';
import {NotesPlaceHolder} from '../ListPlaceholders';
import NoteItem from '../NoteItem';
import SelectionWrapper from '../SelectionWrapper';
-import PullToRefresh from '../PullToRefresh';
-import {DDS} from '../../../App';
let sectionListRef;
export const NotesList = ({
onScroll,
@@ -19,7 +23,7 @@ export const NotesList = ({
searchResults,
}) => {
const [state, dispatch] = useTracked();
- const {colors, selectionMode, currentEditingNote} = state;
+ const {colors, selectionMode, currentEditingNote, loading} = state;
const notes = [...state.notes];
const _renderItem = ({item, index}) => (
@@ -102,26 +106,32 @@ export const NotesList = ({
justifyContent: 'center',
opacity: 0.8,
}}>
- <NotesPlaceHolder animation={slideRight} colors={colors} />
- <NotesPlaceHolder animation={slideLeft} colors={colors} />
- <NotesPlaceHolder animation={slideRight} colors={colors} />
- <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>
+ {loading ? (
+ <ActivityIndicator size={SIZE.xl} color={colors.accent} />
+ ) : (
+ <>
+ <NotesPlaceHolder animation={slideRight} colors={colors} />
+ <NotesPlaceHolder animation={slideLeft} colors={colors} />
+ <NotesPlaceHolder animation={slideRight} colors={colors} />
+ <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>
);
diff --git a/apps/mobile/src/provider/defaultState.js b/apps/mobile/src/provider/defaultState.js
index 12b6775e4..13c9c03da 100644
--- a/apps/mobile/src/provider/defaultState.js
+++ b/apps/mobile/src/provider/defaultState.js
@@ -32,4 +32,5 @@ export const defaultState = {
preventDefaultMargins: false,
isLoginNavigator: false,
currenEditingNote: null,
+ loading: true,
};
diff --git a/apps/mobile/src/utils/eventManager.js b/apps/mobile/src/utils/eventManager.js
new file mode 100644
index 000000000..f5137e8fd
--- /dev/null
+++ b/apps/mobile/src/utils/eventManager.js
@@ -0,0 +1,13 @@
+import {DeviceEventEmitter} from 'react-native';
+
+export const eSubscribeEvent = (eventName, action) => {
+ DeviceEventEmitter.addListener(eventName, action);
+};
+
+export const eUnSubscribeEvent = (eventName, action) => {
+ DeviceEventEmitter.removeListener(eventName, action);
+};
+
+export const eSendEvent = (eventName, data) => {
+ DeviceEventEmitter.emit(eventName, data);
+};
diff --git a/apps/mobile/src/utils/events.js b/apps/mobile/src/utils/events.js
new file mode 100644
index 000000000..f353a1cf5
--- /dev/null
+++ b/apps/mobile/src/utils/events.js
@@ -0,0 +1,27 @@
+export const eOnLoadNote = '500';
+
+export const eOpenActionSheet = '501';
+
+export const eCloseActionSheet = '502';
+
+export const eOpenSimpleDialog = '503';
+
+export const eCloseSimpleDialog = '504';
+
+export const eOpenMoveNoteDialog = '505';
+
+export const eCloseMoveNoteDialog = '506';
+
+export const eOpenAddNotebookDialog = '507';
+
+export const eCloseAddNotebookDialog = '508';
+
+export const eOpenAddTopicDialog = '509';
+
+export const eCloseAddTopicDialog = '510';
+
+export const eOpenLoginDialog = '511';
+
+export const eCloseLoginDialog = '512';
+
+export const eDispatchAction = '513';
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index 109b65a22..38138932f 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -11,7 +11,6 @@ import {
ActivityIndicator,
Text,
} from 'react-native';
-import * as Animatable from 'react-native-animatable';
import Icon from 'react-native-vector-icons/Feather';
import WebView from 'react-native-webview';
import {db, DDS} from '../../../App';
@@ -28,7 +27,11 @@ import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {SideMenuEvent, w, h} from '../../utils/utils';
import {AnimatedSafeAreaView} from '../Home';
+import * as Animatable from 'react-native-animatable';
+const AnimatedKeyboardAvoidingView = Animatable.createAnimatableComponent(
+ KeyboardAvoidingView,
+);
let EditorWebView;
let note = {};
let timestamp = null;
@@ -286,39 +289,6 @@ const Editor = ({navigation, noMenu}) => {
}}
/>
- <Animatable.View
- transition={['translateY']}
- useNativeDriver={true}
- duration={3000}
- style={{
- width: '100%',
- height: '100%',
- justifyContent: 'center',
- alignItems: 'center',
- zIndex: 999,
- position: 'absolute',
- backgroundColor: colors.bg,
- transform: [
- {
- translateY: loading ? 0 : -h * 1.5,
- },
- ],
- }}>
- {loading ? (
- <ActivityIndicator color={colors.accent} size={SIZE.xxxl} />
- ) : null}
-
- <Text
- style={{
- color: colors.accent,
- fontFamily: WEIGHT.regular,
- fontSize: SIZE.md,
- marginTop: 10,
- }}>
- Write with confidence.
- </Text>
- </Animatable.View>
-
{noMenu ? null : (
<TouchableOpacity
onPress={() => {
@@ -504,19 +474,69 @@ const Editor = ({navigation, noMenu}) => {
}, [colors]);
return (
- <AnimatedSafeAreaView
- transition={['backgroundColor', 'width']}
- duration={300}
+ <Animatable.View
+ animation="fadeIn"
+ duration={500}
+ delay={1000}
+ useNativeDriver={true}
style={{
flex: 1,
backgroundColor: 'transparent',
height: '100%',
width: '100%',
- flexDirection: 'row',
- justifyContent: 'space-between',
}}>
- {_renderEditor()}
- </AnimatedSafeAreaView>
+ <AnimatedSafeAreaView
+ transition={['backgroundColor', 'width']}
+ duration={300}
+ style={{
+ flex: 1,
+ backgroundColor: 'transparent',
+ height: '100%',
+ width: '100%',
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ }}>
+ <Animatable.View
+ transition="opacity"
+ useNativeDriver={true}
+ duration={150}
+ style={{
+ width: '100%',
+ height: '100%',
+ justifyContent: 'center',
+ alignItems: 'center',
+ zIndex: 1,
+ opacity: loading ? 1 : 0,
+ position: 'absolute',
+ }}>
+ <ActivityIndicator color={colors.accent} size={SIZE.xxxl} />
+
+ <Text
+ style={{
+ color: colors.accent,
+ fontFamily: WEIGHT.regular,
+ fontSize: SIZE.md,
+ marginTop: 10,
+ }}>
+ Write with confidence.
+ </Text>
+ </Animatable.View>
+
+ <Animatable.View
+ transition={['opacity']}
+ useNativeDriver={true}
+ duration={3000}
+ delay={300}
+ style={{
+ width: '100%',
+ height: '100%',
+ zIndex: 2,
+ opacity: loading ? 0 : 1,
+ }}>
+ {_renderEditor()}
+ </Animatable.View>
+ </AnimatedSafeAreaView>
+ </Animatable.View>
);
};
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index fc23c0535..dcfdaa153 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -114,45 +114,52 @@ export const Home = ({navigation}) => {
}
}}>
<SelectionHeader />
+
<Animatable.View
- transition={['backgroundColor', 'opacity', 'height']}
- duration={300}
- style={{
- position: 'absolute',
- backgroundColor: colors.bg,
- zIndex: 10,
- height: selectionMode ? 0 : null,
- opacity: selectionMode ? 0 : 1,
- width: '100%',
- }}>
- <Header
- menu
- hide={hideHeader}
- verticalMenu
- showSearch={() => {
- setHideHeader(false);
- countUp = 0;
- countDown = 0;
- }}
- colors={colors}
- heading={'Home'}
- canGoBack={false}
- customIcon="menu"
- />
-
- {notes[0] ? (
- <Search
- clear={() => setText('')}
+ animation="fadeIn"
+ useNativeDriver={true}
+ duration={600}
+ delay={700}>
+ <Animatable.View
+ transition={['backgroundColor', 'opacity', 'height']}
+ duration={300}
+ style={{
+ position: 'absolute',
+ backgroundColor: colors.bg,
+ zIndex: 10,
+ height: selectionMode ? 0 : null,
+ opacity: selectionMode ? 0 : 1,
+ width: '100%',
+ }}>
+ <Header
+ menu
hide={hideHeader}
- onChangeText={onChangeText}
- onSubmitEditing={onSubmitEditing}
- placeholder="Search your notes"
- onBlur={onBlur}
- onFocus={onFocus}
- clearSearch={clearSearch}
- value={text}
+ verticalMenu
+ showSearch={() => {
+ setHideHeader(false);
+ countUp = 0;
+ countDown = 0;
+ }}
+ colors={colors}
+ heading={'Home'}
+ canGoBack={false}
+ customIcon="menu"
/>
- ) : null}
+
+ {notes[0] ? (
+ <Search
+ clear={() => setText('')}
+ hide={hideHeader}
+ onChangeText={onChangeText}
+ onSubmitEditing={onSubmitEditing}
+ placeholder="Search your notes"
+ onBlur={onBlur}
+ onFocus={onFocus}
+ clearSearch={clearSearch}
+ value={text}
+ />
+ ) : null}
+ </Animatable.View>
</Animatable.View>
<NotesList