Skip to content

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

refactoring

ammarahm-ed78ec3c722e9e
diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index 925376f16..0c3d4d219 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -42,6 +42,8 @@ export const Container = ({
navigation = null,
isLoginNavigator,
placeholder = '',
+ noSearch = false,
+ noSelectionHeader = false,
}) => {
// State
const [state, dispatch] = useTracked();
@@ -58,14 +60,19 @@ export const Container = ({
const onScroll = y => {
if (searchResults.length > 0) return;
- if (y < 30) setHideHeader(false);
+ if (y < 30) {
+ countUp = 1;
+ countDown = 0;
+ setHideHeader(false);
+ }
+
if (y > offsetY) {
if (y - offsetY < 150 || countDown > 0) return;
countDown = 1;
countUp = 0;
setHideHeader(true);
} else {
- if (offsetY - y < 150 || countUp > 0) return;
+ if (offsetY - y < 50 || countUp > 0) return;
countDown = 0;
countUp = 1;
setHideHeader(false);
@@ -147,7 +154,6 @@ export const Container = ({
duration={300}
style={{
height: '100%',
-
backgroundColor: colors.bg,
}}>
<KeyboardAvoidingView
@@ -156,7 +162,7 @@ export const Container = ({
style={{
height: '100%',
}}>
- <SelectionHeader />
+ {noSelectionHeader ? null : <SelectionHeader />}
<Animatable.View
transition={['backgroundColor', 'opacity', 'height']}
@@ -187,7 +193,7 @@ export const Container = ({
customIcon={customIcon}
/>
- {data[0] ? (
+ {data[0] || !noSearch ? (
<Search
clear={() => setText('')}
hide={hideHeader}
@@ -215,7 +221,7 @@ export const Container = ({
position: 'absolute',
paddingHorizontal: 12,
zIndex: 10,
- bottom: 10,
+ bottom: 15,
transform: [
{
translateY: buttonHide ? 200 : 0,
diff --git a/apps/mobile/src/components/SearchInput/index.js b/apps/mobile/src/components/SearchInput/index.js
index 99204be8b..6785cd1a5 100644
--- a/apps/mobile/src/components/SearchInput/index.js
+++ b/apps/mobile/src/components/SearchInput/index.js
@@ -5,17 +5,16 @@ import Icon from 'react-native-vector-icons/Feather';
import {DDS} from '../../../App';
import {br, SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
-import {w} from '../../utils/utils';
export const Search = props => {
const [state, dispatch] = useTracked();
const {colors} = state;
const [focus, setFocus] = useState(false);
-
const inputRef = createRef();
+
return (
<Animatable.View
- transition={['marginTop', 'borderWidth', 'marginBottom', 'opacity']}
+ transition={['marginTop', 'opacity']}
duration={200}
style={{
opacity: props.hide ? 0 : 1,
diff --git a/apps/mobile/src/provider/reducer.js b/apps/mobile/src/provider/reducer.js
index fba435802..5bc160502 100644
--- a/apps/mobile/src/provider/reducer.js
+++ b/apps/mobile/src/provider/reducer.js
@@ -24,6 +24,14 @@ export const reducer = (state, action) => {
notebooks: notebooks,
};
}
+ case ACTIONS.TRASH: {
+ let trash = [...db.getTrash()];
+
+ return {
+ ...state,
+ trash: trash,
+ };
+ }
case ACTIONS.PINNED: {
let pinned = [...db.getPinned()];
return {
diff --git a/apps/mobile/src/views/Favorites/index.js b/apps/mobile/src/views/Favorites/index.js
index ed564c921..c6b7a1b2e 100644
--- a/apps/mobile/src/views/Favorites/index.js
+++ b/apps/mobile/src/views/Favorites/index.js
@@ -1,93 +1,38 @@
-import React, {useEffect, useState} from 'react';
+import React, {useEffect} from 'react';
import {FlatList, Platform, Text, View} from 'react-native';
-import * as Animatable from 'react-native-animatable';
import {SIZE, WEIGHT} from '../../common/common';
import Container from '../../components/Container';
-import {Header} from '../../components/header';
import {FavoritesPlaceHolder} from '../../components/ListPlaceholders';
import {NotebookItem} from '../../components/NotebookItem';
import NoteItem from '../../components/NoteItem';
-import {Search} from '../../components/SearchInput';
import SelectionWrapper from '../../components/SelectionWrapper';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
+import {eSendEvent} from '../../services/eventManager';
+import {eScrollEvent} from '../../services/events';
export const Favorites = ({navigation}) => {
- // Global State
const [state, dispatch] = useTracked();
const {colors, selectionMode, favorites} = state;
- // Local State
- const [text, setText] = useState('');
- const [hideHeader, setHideHeader] = useState(false);
- const [buttonHide, setButtonHide] = useState(false);
-
- // Variables
-
- let offsetY = 0;
- let countUp = 1;
- let countDown = 0;
-
useEffect(() => {
dispatch({type: ACTIONS.FAVORITES});
}, []);
- // Functions
-
- // Effects
const onScroll = event => {
let y = event.nativeEvent.contentOffset.y;
- if (buttonHide) return;
- if (y < 30) setHideHeader(false);
- if (y > offsetY) {
- if (y - offsetY < 150 || countDown > 0) return;
- countDown = 1;
- countUp = 0;
- setHideHeader(true);
- } else {
- if (offsetY - y < 150 || countUp > 0) return;
- countDown = 0;
- countUp = 1;
- setHideHeader(false);
- }
- offsetY = y;
+ eSendEvent(eScrollEvent, y);
};
- // Render
return (
- <Container noBottomButton={true}>
- <Animatable.View
- transition="backgroundColor"
- duration={300}
- style={{
- position: 'absolute',
- backgroundColor: colors.night ? colors.bg : colors.bg,
- zIndex: 10,
- width: '100%',
- }}>
- <Header
- menu={true}
- hide={hideHeader}
- showSearch={() => {
- setHideHeader(false);
- countUp = 0;
- countDown = 0;
- }}
- colors={colors}
- heading="Favorites"
- canGoBack={false}
- customIcon="menu"
- />
- {favorites.length > 0 ? (
- <Search
- clear={() => setText('')}
- hide={hideHeader}
- placeholder="Search your notes"
- value={text}
- />
- ) : null}
- </Animatable.View>
-
+ <Container
+ menu={true}
+ heading="Favorites"
+ placeholder="Search your notes"
+ canGoBack={false}
+ customIcon="menu"
+ data={favorites}
+ noBottomButton={true}>
<FlatList
keyExtractor={item => item.dateCreated.toString()}
style={{
diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.js
index e53c8a10a..51c83d0d9 100644
--- a/apps/mobile/src/views/Folders/index.js
+++ b/apps/mobile/src/views/Folders/index.js
@@ -1,22 +1,19 @@
-import React, {useEffect, useState} from 'react';
-import {FlatList, Platform, Text, View, BackHandler} from 'react-native';
-import * as Animatable from 'react-native-animatable';
+import React, {useEffect} from 'react';
+import {BackHandler, FlatList, Platform, Text, View} from 'react-native';
import {useIsFocused} from 'react-navigation-hooks';
+import {DDS} from '../../../App';
import {SIZE, WEIGHT} from '../../common/common';
-import {AddNotebookDialog} from '../../components/AddNotebookDialog';
import Container from '../../components/Container';
-import {Header} from '../../components/header';
+import {AddNotebookEvent} from '../../components/DialogManager';
import {NotebookPlaceHolder} from '../../components/ListPlaceholders';
import {NotebookItem} from '../../components/NotebookItem';
-import {Search} from '../../components/SearchInput';
-import SelectionHeader from '../../components/SelectionHeader';
import SelectionWrapper from '../../components/SelectionWrapper';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
+import {eSendEvent} from '../../services/eventManager';
+import {eScrollEvent} from '../../services/events';
import {slideLeft, slideRight} from '../../utils/animations';
import {w} from '../../utils/utils';
-import {AddNotebookEvent} from '../../components/DialogManager';
-import {DDS} from '../../../App';
export const Folders = ({navigation}) => {
const [state, dispatch] = useTracked();
@@ -26,7 +23,6 @@ export const Folders = ({navigation}) => {
pinned,
notebooks,
preventDefaultMargins,
- selectedItemsList,
} = state;
let isFocused = useIsFocused();
///
@@ -58,70 +54,27 @@ export const Folders = ({navigation}) => {
};
}, [isFocused]);
- const [addNotebook, setAddNotebook] = useState(false);
- const [hideHeader, setHideHeader] = useState(false);
-
const params = navigation.state.params;
- let offsetY = 0;
- let countUp = 0;
- let countDown = 0;
const onScroll = event => {
- y = event.nativeEvent.contentOffset.y;
- if (y < 30) setHideHeader(false);
- //if (buttonHide) return;
- if (y > offsetY) {
- if (y - offsetY < 150 || countDown > 0) return;
- countDown = 1;
- countUp = 0;
- setHideHeader(true);
- } else {
- if (offsetY - y < 150 || countUp > 0) return;
- countDown = 0;
- countUp = 1;
- setHideHeader(false);
- }
- offsetY = y;
+ let y = event.nativeEvent.contentOffset.y;
+
+ eSendEvent(eScrollEvent, y);
};
return (
<Container
bottomButtonText="Add a new notebook"
+ menu={params.canGoBack ? false : true}
+ preventDefaultMargins={preventDefaultMargins}
+ heading={params.title}
+ canGoBack={params.canGoBack}
+ navigation={navigation}
+ placeholder="Search your notebook"
+ data={notebooks}
bottomButtonOnPress={() => {
AddNotebookEvent(null);
}}>
- <SelectionHeader />
-
- <Animatable.View
- transition={['backgroundColor', 'opacity', 'height']}
- duration={300}
- style={{
- position: 'absolute',
- backgroundColor: colors.bg,
- height: selectionMode ? 0 : null,
- opacity: selectionMode ? 0 : 1,
- zIndex: 20,
- width: '100%',
- }}>
- <Header
- hide={hideHeader}
- menu={params.canGoBack ? false : true}
- preventDefaultMargins={preventDefaultMargins}
- navigation={navigation}
- showSearch={() => {
- setHideHeader(false);
- countUp = 0;
- countDown = 0;
- }}
- colors={colors}
- heading={params.title}
- canGoBack={params.canGoBack}
- />
- {notebooks.length == 0 ? null : (
- <Search placeholder="Search your notebook" hide={hideHeader} />
- )}
- </Animatable.View>
-
<FlatList
style={{
width: '100%',
diff --git a/apps/mobile/src/views/Notebook/index.js b/apps/mobile/src/views/Notebook/index.js
index 2e7b58ad9..de841fd4e 100644
--- a/apps/mobile/src/views/Notebook/index.js
+++ b/apps/mobile/src/views/Notebook/index.js
@@ -1,31 +1,22 @@
-import React, {useEffect, useState} from 'react';
+import React, {useEffect} from 'react';
import {FlatList, Platform, Text, View} from 'react-native';
-import * as Animatable from 'react-native-animatable';
import {useIsFocused} from 'react-navigation-hooks';
import {SIZE, WEIGHT} from '../../common/common';
import Container from '../../components/Container';
-import {Header} from '../../components/header';
import {NotebookItem} from '../../components/NotebookItem';
-import {Search} from '../../components/SearchInput';
import {useTracked} from '../../provider';
-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';
-import {eMoveNoteDialogNavigateBack} from '../../services/events';
+import {
+ eSendEvent,
+ eSubscribeEvent,
+ eUnSubscribeEvent,
+} from '../../services/eventManager';
+import {eMoveNoteDialogNavigateBack, eScrollEvent} from '../../services/events';
export const Notebook = ({navigation}) => {
const [state, dispatch] = useTracked();
- const {
- colors,
- selectionMode,
- pinned,
- selectedItemsList,
- preventDefaultMargins,
- } = state;
-
- ///
+ const {colors, selectionMode, preventDefaultMargins} = state;
const params = navigation.state.params;
- const [hideHeader, setHideHeader] = useState(false);
- const [buttonHide, setButtonHide] = useState(false);
let isFocused = useIsFocused();
@@ -40,119 +31,83 @@ export const Notebook = ({navigation}) => {
};
}, [isFocused]);
- // State
+ const onScroll = event => {
+ let y = event.nativeEvent.contentOffset.y;
+ eSendEvent(eScrollEvent, y);
+ };
- // Variables
- let offsetY = 0;
- let countUp = 0;
- let countDown = 0;
+ const keyExtractor = (item, index) =>
+ item.dateCreated.toString() + index.toString();
- // Effects
+ const renderItem = ({item, index}) => (
+ <NotebookItem
+ hideMore={params.hideMore}
+ isTopic={true}
+ noteToMove={params.note}
+ notebookID={params.notebook.dateCreated}
+ isMove={params.isMove}
+ refresh={() => {}}
+ item={item}
+ index={index}
+ colors={colors}
+ data={params.notebooks.topics}
+ />
+ );
- // Functions
+ ListFooterComponent = (
+ <View
+ style={{
+ height: 150,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}>
+ <Text
+ style={{
+ color: colors.navbg,
+ fontSize: SIZE.sm,
+ fontFamily: WEIGHT.regular,
+ }}>
+ - End -
+ </Text>
+ </View>
+ );
+
+ ListHeaderComponent = (
+ <View
+ style={{
+ marginTop:
+ Platform.OS == 'ios'
+ ? params.notebook.topics[0] && !selectionMode
+ ? 135
+ : 135 - 60
+ : params.notebook.topics[0] && !selectionMode
+ ? 155
+ : 155 - 60,
+ }}
+ />
+ );
- // Render
return (
<Container
bottomButtonText="Add new topic"
+ preventDefaultMargins={preventDefaultMargins}
+ navigation={navigation}
+ placeholder={`Search in ${params.title}`}
+ heading={params.title}
+ canGoBack={true}
bottomButtonOnPress={() => {
//setAddTopic(true);
}}>
- <Animatable.View
- transition="backgroundColor"
- duration={300}
- style={{
- position: 'absolute',
- backgroundColor: colors.bg,
- zIndex: 10,
- width: '100%',
- }}>
- <Header
- hide={hideHeader}
- preventDefaultMargins={preventDefaultMargins}
- navigation={navigation}
- showSearch={() => {
- setHideHeader(false);
- countUp = 0;
- countDown = 0;
- }}
- colors={colors}
- heading={params.title}
- canGoBack={true}
- />
-
- <Search placeholder={`Search in ${params.title}`} hide={hideHeader} />
- </Animatable.View>
-
<FlatList
style={{
width: '100%',
}}
data={params.notebook.topics}
- onScroll={event => {
- y = event.nativeEvent.contentOffset.y;
- if (y < 30) setHideHeader(false);
- if (buttonHide) return;
- if (y > offsetY) {
- if (y - offsetY < 150 || countDown > 0) return;
- countDown = 1;
- countUp = 0;
- setHideHeader(true);
- } else {
- if (offsetY - y < 150 || countUp > 0) return;
- countDown = 0;
- countUp = 1;
- setHideHeader(false);
- }
- offsetY = y;
- }}
- ListHeaderComponent={
- <View
- style={{
- marginTop:
- Platform.OS == 'ios'
- ? params.notebook.topics[0] && !selectionMode
- ? 135
- : 135 - 60
- : params.notebook.topics[0] && !selectionMode
- ? 155
- : 155 - 60,
- }}
- />
- }
- ListFooterComponent={
- <View
- style={{
- height: 150,
- alignItems: 'center',
- justifyContent: 'center',
- }}>
- <Text
- style={{
- color: colors.navbg,
- fontSize: SIZE.sm,
- fontFamily: WEIGHT.regular,
- }}>
- - End -
- </Text>
- </View>
- }
- keyExtractor={(item, index) =>
- item.dateCreated.toString() + index.toString()
- }
- renderItem={({item, index}) => (
- <NotebookItem
- hideMore={params.hideMore}
- isTopic={true}
- noteToMove={params.note}
- notebookID={params.notebook.dateCreated}
- isMove={params.isMove}
- refresh={() => {}}
- item={item}
- index={index}
- colors={colors}
- />
- )}
+ onScroll={onScroll}
+ ListHeaderComponent={ListHeaderComponent}
+ ListFooterComponent={ListFooterComponent}
+ keyExtractor={keyExtractor}
+ renderItem={renderItem}
/>
</Container>
);
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index b2a161ed7..6a3c58e2b 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -1,35 +1,15 @@
import React, {useEffect, useState} from 'react';
-import * as Animatable from 'react-native-animatable';
-import {useIsFocused} from 'react-navigation-hooks';
import {db} from '../../../App';
import Container from '../../components/Container';
-import {Header} from '../../components/header';
import {NotesList} from '../../components/NotesList';
-import {Search} from '../../components/SearchInput';
import {useTracked} from '../../provider';
export const Notes = ({navigation}) => {
const [state, dispatch] = useTracked();
- const {colors, selectionMode, pinned, selectedItemsList} = state;
- ///
- const updateDB = () => {};
- const updateSelectionList = () => {};
- const changeSelectionMode = () => {};
- const [hideHeader, setHideHeader] = useState(false);
- const [margin, setMargin] = useState(200);
- const [buttonHide, setButtonHide] = useState(false);
const [notes, setNotes] = useState([]);
- let isFocused = useIsFocused();
-
let params = navigation.state ? navigation.state.params : null;
- let offsetY = 0;
- let countUp = 0;
- let countDown = 0;
- let headerHeight = 0;
- let searchHeight = 0;
- let marginSet = false;
useEffect(() => {
if (!params) {
@@ -45,71 +25,19 @@ export const Notes = ({navigation}) => {
setNotes(allNotes);
}
}, []);
- if (!isFocused) {
- console.log('block rerender');
- return <></>;
- } else {
- return (
- <Container
- bottomButtonText="Create a new note"
- bottomButtonOnPress={() => {}}>
- <Animatable.View
- transition="backgroundColor"
- duration={300}
- style={{
- position: 'absolute',
- backgroundColor: colors.bg,
- zIndex: 10,
- width: '100%',
- }}>
- <Header
- sendHeight={height => (headerHeight = height)}
- hide={hideHeader}
- showSearch={() => {
- setHideHeader(false);
- countUp = 0;
- countDown = 0;
- }}
- colors={colors}
- canGoBack={false}
- colors={colors}
- heading={params.title}
- canGoBack={true}
- />
- <Search
- sendHeight={height => {
- searchHeight = height;
- }}
- placeholder={`Search in ${params.title}`}
- hide={hideHeader}
- />
- </Animatable.View>
- <NotesList
- margin={margin}
- onScroll={y => {
- if (buttonHide) return;
- if (y < 30) setHideHeader(false);
- if (y > offsetY) {
- if (y - offsetY < 150 || countDown > 0) return;
- countDown = 1;
- countUp = 0;
- setHideHeader(true);
- } else {
- if (offsetY - y < 150 || countUp > 0) return;
- countDown = 0;
- countUp = 1;
- setHideHeader(false);
- }
- offsetY = y;
- }}
- isSearch={false}
- notes={notes}
- keyword={null}
- />
- </Container>
- );
- }
+ return (
+ <Container
+ bottomButtonText="Create a new note"
+ canGoBack={false}
+ heading={params.title}
+ canGoBack={true}
+ data={notes}
+ placeholder={`Search in ${params.title}`}
+ bottomButtonOnPress={() => {}}>
+ <NotesList isSearch={false} notes={notes} keyword={null} />
+ </Container>
+ );
};
Notes.navigationOptions = {
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 40614807d..80388c040 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -44,166 +44,170 @@ export const Settings = ({navigation}) => {
}
return (
- <Container noBottomButton={true}>
- <View>
- <Header
- menu={true}
- colors={colors}
- heading="Settings"
- canGoBack={false}
- />
-
- <FlatList
- data={[
- {
- name: 'General',
- func: () => {},
- },
- {
- name: 'Account',
- func: () => {
- NavigationService.navigate('AccountSettings');
- },
+ <Container
+ menu={true}
+ heading="Settings"
+ canGoBack={false}
+ noSearch={true}
+ noSelectionHeader={true}
+ noBottomButton={true}>
+ <FlatList
+ ListHeaderComponent={
+ <View
+ style={{
+ marginTop: Platform.OS == 'ios' ? 135 - 60 : 155 - 60,
+ }}
+ />
+ }
+ data={[
+ {
+ name: 'General',
+ func: () => {},
+ },
+ {
+ name: 'Account',
+ func: () => {
+ NavigationService.navigate('AccountSettings');
},
- {
- name: 'Theme',
- customComponent: (
- <View>
- <ScrollView
- contentContainerStyle={{
- flexDirection: 'row',
- flexWrap: 'wrap',
- marginTop: 10,
- marginHorizontal: 20,
- }}>
- {[
- '#e6194b',
- '#3cb44b',
- '#ffe119',
- '#0560FF',
- '#f58231',
- '#911eb4',
- '#46f0f0',
- '#f032e6',
- '#bcf60c',
- '#fabebe',
- ].map(item => (
- <TouchableOpacity
- key={item}
- onPress={() => {
- changeAccentColor(item);
+ },
+ {
+ name: 'Theme',
+ customComponent: (
+ <View>
+ <ScrollView
+ contentContainerStyle={{
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ marginTop: 10,
+ marginHorizontal: 20,
+ }}>
+ {[
+ '#e6194b',
+ '#3cb44b',
+ '#ffe119',
+ '#0560FF',
+ '#f58231',
+ '#911eb4',
+ '#46f0f0',
+ '#f032e6',
+ '#bcf60c',
+ '#fabebe',
+ ].map(item => (
+ <TouchableOpacity
+ key={item}
+ onPress={() => {
+ changeAccentColor(item);
- FastStorage.setItem('accentColor', item);
- }}
+ FastStorage.setItem('accentColor', item);
+ }}
+ style={{
+ flexDirection: 'row',
+ justifyContent: 'flex-start',
+ alignItems: 'center',
+ marginRight: 10,
+ marginVertical: 5,
+ }}>
+ <View
style={{
- flexDirection: 'row',
- justifyContent: 'flex-start',
+ width: 45,
+ height: 45,
+ backgroundColor: item,
+ borderRadius: 100,
+ justifyContent: 'center',
alignItems: 'center',
- marginRight: 10,
- marginVertical: 5,
}}>
- <View
- style={{
- width: 45,
- height: 45,
- backgroundColor: item,
- borderRadius: 100,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- {colors.accent === item ? (
- <Icon size={SIZE.lg} color="white" name="check" />
- ) : null}
- </View>
- </TouchableOpacity>
- ))}
- </ScrollView>
- <TouchableOpacity
- onPress={() => {
- if (!colors.night) {
- FastStorage.setItem(
- 'theme',
- JSON.stringify({night: true}),
- );
- changeColorScheme(COLOR_SCHEME_DARK);
- } else {
- FastStorage.setItem(
- 'theme',
- JSON.stringify({night: false}),
- );
+ {colors.accent === item ? (
+ <Icon size={SIZE.lg} color="white" name="check" />
+ ) : null}
+ </View>
+ </TouchableOpacity>
+ ))}
+ </ScrollView>
+ <TouchableOpacity
+ onPress={() => {
+ if (!colors.night) {
+ FastStorage.setItem(
+ 'theme',
+ JSON.stringify({night: true}),
+ );
+ changeColorScheme(COLOR_SCHEME_DARK);
+ } else {
+ FastStorage.setItem(
+ 'theme',
+ JSON.stringify({night: false}),
+ );
- changeColorScheme(COLOR_SCHEME_LIGHT);
- }
- }}
- activeOpacity={opacity}
+ changeColorScheme(COLOR_SCHEME_LIGHT);
+ }
+ }}
+ activeOpacity={opacity}
+ style={{
+ width: '85%',
+ marginHorizontal: '5%',
+ paddingVertical: pv + 10,
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ }}>
+ <Text
style={{
- width: '85%',
- marginHorizontal: '5%',
- paddingVertical: pv + 10,
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'space-between',
+ fontSize: SIZE.sm + 1,
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ color: colors.pri,
}}>
- <Text
- style={{
- fontSize: SIZE.sm + 1,
- fontFamily: WEIGHT.regular,
- textAlignVertical: 'center',
- color: colors.pri,
- }}>
- Dark Mode
- </Text>
- <Icon
- size={SIZE.md}
- color={colors.night ? colors.accent : colors.icon}
- name={colors.night ? 'toggle-right' : 'toggle-left'}
- />
- </TouchableOpacity>
- </View>
- ),
- },
- {
- name: 'Terms of Service',
- func: () => {},
- },
- {
- name: 'Privacy Policy',
- func: () => {},
- },
- {
- name: 'About',
- func: () => {},
- },
- ]}
- keyExtractor={item => item.name}
- renderItem={({item, index}) => (
- <TouchableOpacity
- key={item.name}
- activeOpacity={opacity}
- onPress={item.func}
- style={{
- borderBottomWidth: 1,
- width: item.step ? '85%' : '90%',
- marginHorizontal: '5%',
- borderBottomColor: colors.nav,
- paddingVertical: pv + 5,
+ Dark Mode
+ </Text>
+ <Icon
+ size={SIZE.md}
+ color={colors.night ? colors.accent : colors.icon}
+ name={colors.night ? 'toggle-right' : 'toggle-left'}
+ />
+ </TouchableOpacity>
+ </View>
+ ),
+ },
+ {
+ name: 'Terms of Service',
+ func: () => {},
+ },
+ {
+ name: 'Privacy Policy',
+ func: () => {},
+ },
+ {
+ name: 'About',
+ func: () => {},
+ },
+ ]}
+ keyExtractor={item => item.name}
+ renderItem={({item, index}) => (
+ <TouchableOpacity
+ key={item.name}
+ activeOpacity={opacity}
+ onPress={item.func}
+ style={{
+ borderBottomWidth: 1,
+ width: item.step ? '85%' : '90%',
+ marginHorizontal: '5%',
+ borderBottomColor: colors.nav,
+ paddingVertical: pv + 5,
- marginLeft: item.step ? '10%' : '5%',
+ marginLeft: item.step ? '10%' : '5%',
+ }}>
+ <Text
+ style={{
+ fontSize: item.step ? SIZE.sm : SIZE.md,
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ color: colors.pri,
}}>
- <Text
- style={{
- fontSize: item.step ? SIZE.sm : SIZE.md,
- fontFamily: WEIGHT.regular,
- textAlignVertical: 'center',
- color: colors.pri,
- }}>
- {item.name}
- </Text>
- {item.customComponent ? item.customComponent : null}
- </TouchableOpacity>
- )}
- />
- </View>
+ {item.name}
+ </Text>
+ {item.customComponent ? item.customComponent : null}
+ </TouchableOpacity>
+ )}
+ />
</Container>
);
};
diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.js
index 803e6bad5..c52bfa013 100644
--- a/apps/mobile/src/views/Trash/index.js
+++ b/apps/mobile/src/views/Trash/index.js
@@ -6,11 +6,9 @@ import {
simpleDialogEvent,
TEMPLATE_EMPTY_TRASH,
} from '../../components/DialogManager';
-import {Header} from '../../components/header';
import {TrashPlaceHolder} from '../../components/ListPlaceholders';
import {NotebookItem} from '../../components/NotebookItem';
import NoteItem from '../../components/NoteItem';
-import SelectionHeader from '../../components/SelectionHeader';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {w} from '../../utils/utils';
@@ -23,7 +21,7 @@ export const Trash = ({navigation}) => {
dispatch({
type: ACTIONS.TRASH,
});
- });
+ }, []);
const _renderItem = ({item, index}) => (
<SelectionWrapper item={item}>
@@ -71,7 +69,7 @@ export const Trash = ({navigation}) => {
</SelectionWrapper>
);
- _ListEmptyComponent = (
+ const _ListEmptyComponent = (
<View
style={{
height: '80%',
@@ -107,13 +105,19 @@ export const Trash = ({navigation}) => {
bottomButtonOnPress={() => {
simpleDialogEvent(TEMPLATE_EMPTY_TRASH);
}}
+ noSearch={true}
+ heading="Trash"
+ canGoBack={false}
+ menu={true}
bottomButtonText="Clear all trash">
- <SelectionHeader />
- {selectionMode ? null : (
- <Header colors={colors} heading="Trash" canGoBack={false} menu={true} />
- )}
-
<FlatList
+ ListHeaderComponent={
+ <View
+ style={{
+ marginTop: Platform.OS == 'ios' ? 135 - 60 : 155 - 60,
+ }}
+ />
+ }
keyExtractor={item => item.dateCreated.toString()}
style={{
width: '100%',