Skip to content

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

remove SearchInput

ammarahm-ed1deaeba10ec5
diff --git a/apps/mobile/android/app/src/main/assets/listeners.js b/apps/mobile/android/app/src/main/assets/listeners.js
index 367069634..512d29527 100644
--- a/apps/mobile/android/app/src/main/assets/listeners.js
+++ b/apps/mobile/android/app/src/main/assets/listeners.js
@@ -22,13 +22,13 @@ function onTitleChange() {
};
if (titleMessage && typeof titleMessage.value === 'string') {
- //window.ReactNativeWebView.postMessage(JSON.stringify(titleMessage));
+ window.ReactNativeWebView.postMessage(JSON.stringify(titleMessage));
}
}
function attachEditorListeners() {
editor.once('text-change', function () {
- //window.ReactNativeWebView.postMessage('loaded');
+ window.ReactNativeWebView.postMessage('loaded');
let text = editor.getText();
document.getElementById('infowords').innerText =
text.split(' ').length + ' words';
@@ -203,6 +203,6 @@ function attachEditorListeners() {
m.text.split(' ').length + ' words';
m.html = editor.root.innerHTML;
m.type = 'content';
- //window.ReactNativeWebView.postMessage(JSON.stringify(m));
+ window.ReactNativeWebView.postMessage(JSON.stringify(m));
});
}
diff --git a/apps/mobile/src/components/Container/ContainerTopSection.js b/apps/mobile/src/components/Container/ContainerTopSection.js
index b1a529f67..0c6b62508 100644
--- a/apps/mobile/src/components/Container/ContainerTopSection.js
+++ b/apps/mobile/src/components/Container/ContainerTopSection.js
@@ -2,7 +2,6 @@ import React, {useEffect} from 'react';
import Animated, {Easing, useValue} from 'react-native-reanimated';
import {useTracked} from '../../provider';
import {Header} from '../Header';
-import {Search} from '../SearchInput';
export const ContainerTopSection = ({root}) => {
const [state,] = useTracked();
@@ -25,10 +24,7 @@ export const ContainerTopSection = ({root}) => {
return (
<Animated.View
style={{
- position: 'absolute',
backgroundColor: colors.bg,
- zIndex: 998,
- display: 'flex',
width: '100%',
opacity: opacity,
overflow: 'hidden',
@@ -38,10 +34,7 @@ export const ContainerTopSection = ({root}) => {
},
],
}}>
-
-
<Header root={root} />
- <Search root={root} />
</Animated.View>
);
};
diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index c89bbc7c8..47ce1efd8 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -1,20 +1,15 @@
import React from 'react';
import {KeyboardAvoidingView, Platform, SafeAreaView} from 'react-native';
-import {useSafeAreaInsets} from 'react-native-safe-area-context';
import SelectionHeader from '../SelectionHeader';
import {ContainerTopSection} from './ContainerTopSection';
export const Container = ({children, root}) => {
- const insets = useSafeAreaInsets()
return (
- <KeyboardAvoidingView
- behavior="padding"
- enabled={Platform.OS === 'ios'}>
+ <KeyboardAvoidingView behavior="padding" enabled={Platform.OS === 'ios'}>
<SafeAreaView
style={{
height: '100%',
- paddingTop: insets.top,
}}>
<SelectionHeader />
<ContainerTopSection root={root} />
diff --git a/apps/mobile/src/components/Header/index.js b/apps/mobile/src/components/Header/index.js
index d5430d1fb..54bf8d1b6 100644
--- a/apps/mobile/src/components/Header/index.js
+++ b/apps/mobile/src/components/Header/index.js
@@ -1,52 +1,32 @@
-import React, { useEffect, useState } from 'react';
+import React, {useEffect, useState} from 'react';
import {ActivityIndicator, Platform, StyleSheet, View} from 'react-native';
import * as Animatable from 'react-native-animatable';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
import {useTracked} from '../../provider';
-import {eSendEvent, eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
+import {
+ eSendEvent,
+ eSubscribeEvent,
+ eUnSubscribeEvent,
+} from '../../services/EventManager';
import {dWidth} from '../../utils';
import {ActionIcon} from '../ActionIcon';
import {HeaderMenu} from './HeaderMenu';
import {HeaderTitle} from './HeaderTitle';
-import {SIZE} from "../../utils/SizeUtils";
-import {HeaderLeftMenu} from "./HeaderLeftMenu";
-import { eScrollEvent } from '../../utils/Events';
+import {SIZE} from '../../utils/SizeUtils';
+import {HeaderLeftMenu} from './HeaderLeftMenu';
+import {eScrollEvent} from '../../utils/Events';
-let timeout = null;
-export const Header = ({ root}) => {
- const [state, ] = useTracked();
+export const Header = ({root}) => {
+ const [state] = useTracked();
const {colors, syncing} = state;
const insets = useSafeAreaInsets();
- const [hideHeader,setHideHeader] = useState(false);
-
- const {
- searchResults,
- } = state;
- let offsetY = 0;
-
+ const [hide, setHide] = useState(false);
const onScroll = (y) => {
- if (searchResults.results.length > 0) return;
- if (y < 30) {
- setHideHeader(false);
- offsetY = y;
- }
- if (y > offsetY) {
- if (y - offsetY < 100) return;
- clearTimeout(timeout);
- timeout = null;
- timeout = setTimeout(() => {
- setHideHeader(true);
- }, 300);
- offsetY = y;
+ if (y > 3) {
+ setHide(false);
} else {
- if (offsetY - y < 50) return;
- clearTimeout(timeout);
- timeout = null;
- timeout = setTimeout(() => {
- setHideHeader(false);
- }, 300);
- offsetY = y;
+ setHide(true);
}
};
@@ -65,10 +45,12 @@ export const Header = ({ root}) => {
marginTop: insets.top,
backgroundColor: colors.bg,
overflow: 'hidden',
+ borderBottomWidth: 1,
+ borderBottomColor: hide ? 'transparent' : colors.nav,
},
]}>
<View style={styles.leftBtnContainer}>
- <HeaderLeftMenu/>
+ <HeaderLeftMenu />
{Platform.OS === 'android' ? <HeaderTitle root={root} /> : null}
</View>
{Platform.OS !== 'android' ? <HeaderTitle root={root} /> : null}
@@ -94,26 +76,17 @@ export const Header = ({ root}) => {
</Animatable.View>
<View style={styles.rightBtnContainer}>
- <Animatable.View
- transition="opacity"
- useNativeDriver={true}
- duration={500}
- style={{
- opacity: hideHeader ? 1 : 0,
- }}>
- <ActionIcon
- onPress={() => {
- if (!hideHeader) return;
- setHideHeader(false);
- eSendEvent('showSearch');
- }}
- name="magnify"
- size={SIZE.xl}
- color={colors.pri}
- style={styles.rightBtn}
- />
- </Animatable.View>
-
+ <ActionIcon
+ onPress={() => {
+ if (!hideHeader) return;
+ setHideHeader(false);
+ eSendEvent('showSearch');
+ }}
+ name="magnify"
+ size={SIZE.xxxl}
+ color={colors.pri}
+ style={styles.rightBtn}
+ />
</View>
</View>
);
@@ -124,7 +97,6 @@ const styles = StyleSheet.create({
flexDirection: 'row',
zIndex: 11,
height: 50,
- marginBottom: 10,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 12,
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index feb085e5b..b266a8f7a 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -7,7 +7,6 @@ import {
useWindowDimensions,
View,
} from 'react-native';
-import {useSafeAreaInsets} from 'react-native-safe-area-context';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
import {useTracked} from '../../provider';
@@ -52,7 +51,6 @@ const SimpleList = ({
}),
);
const {width, fontScale} = useWindowDimensions();
- const insets = useSafeAreaInsets();
const listData = data;
const dataType = type;
@@ -224,22 +222,6 @@ const SimpleList = ({
}
};
- const listStyle = useMemo(() => {
- return {
- height: '100%',
- backgroundColor: colors.bg,
- width: '100%',
- paddingTop:
- Platform.OS === 'ios'
- ? listData[0] && !selectionMode
- ? 130
- : 130 - 60
- : listData[0] && !selectionMode
- ? 155 - insets.top
- : 155 - insets.top - 60,
- };
- }, [selectionMode, listData, colors, insets]);
-
return !listData || listData.length === 0 || !dataProvider ? (
_ListEmptyComponent
) : (
@@ -266,7 +248,12 @@ const SimpleList = ({
minHeight: '100%',
},
}}
- style={listStyle}
+ style={{
+ height: '100%',
+ backgroundColor: colors.bg,
+ width: '100%',
+ paddingTop:10
+ }}
/>
);
};
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.js
index 38d4d8866..5f0b1f9a3 100644
--- a/apps/mobile/src/views/Editor/EditorHeader.js
+++ b/apps/mobile/src/views/Editor/EditorHeader.js
@@ -52,16 +52,12 @@ const EditorHeader = ({noMenu}) => {
eSubscribeEvent(eOnLoadNote, load);
eSubscribeEvent(eCloseFullscreenEditor, closeFullscreen);
eSubscribeEvent(eClearEditor, onCallClear);
- Keyboard.addListener("keyboardDidShow",() => {
- post("keyboard")
- })
+
return () => {
eUnSubscribeEvent(eClearEditor, onCallClear);
eUnSubscribeEvent(eCloseFullscreenEditor, closeFullscreen);
eUnSubscribeEvent(eOnLoadNote, load);
- Keyboard.removeListener("keyboardDidShow",() => {
- post("keyboard")
- })
+
};
}, []);
@@ -84,6 +80,9 @@ const EditorHeader = ({noMenu}) => {
}, [noMenu]);
const load = async (item) => {
+ Keyboard.addListener("keyboardDidShow",() => {
+ post("keyboard")
+ })
await loadNote(item);
if (item.type === 'new') {
textInput.current?.focus();
@@ -139,6 +138,9 @@ const EditorHeader = ({noMenu}) => {
ToastEvent.show('Note Saved!', 'success');
}
await clearEditor();
+ Keyboard.removeListener("keyboardDidShow",() => {
+ post("keyboard")
+ })
if (handleBack) {
handleBack.remove();
handleBack = null;
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index 206515d71..b99070ea6 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -332,8 +332,6 @@ const loadNoteInEditor = async () => {
await sleep(50);
post('title', title);
post('delta', content.delta);
- } else {
- post('focusTitle');
}
await sleep(50);
post('clearHistory');