mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
remove SearchInput
This commit is contained in:
@@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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} />
|
||||
|
||||
@@ -3,50 +3,30 @@ 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 {SIZE} from '../../utils/SizeUtils';
|
||||
import {HeaderLeftMenu} from './HeaderLeftMenu';
|
||||
import {eScrollEvent} from '../../utils/Events';
|
||||
|
||||
let timeout = null;
|
||||
export const Header = ({root}) => {
|
||||
const [state, ] = useTracked();
|
||||
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,6 +45,8 @@ export const Header = ({ root}) => {
|
||||
marginTop: insets.top,
|
||||
backgroundColor: colors.bg,
|
||||
overflow: 'hidden',
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: hide ? 'transparent' : colors.nav,
|
||||
},
|
||||
]}>
|
||||
<View style={styles.leftBtnContainer}>
|
||||
@@ -94,13 +76,6 @@ 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;
|
||||
@@ -108,12 +83,10 @@ export const Header = ({ root}) => {
|
||||
eSendEvent('showSearch');
|
||||
}}
|
||||
name="magnify"
|
||||
size={SIZE.xl}
|
||||
size={SIZE.xxxl}
|
||||
color={colors.pri}
|
||||
style={styles.rightBtn}
|
||||
/>
|
||||
</Animatable.View>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
@@ -124,7 +97,6 @@ const styles = StyleSheet.create({
|
||||
flexDirection: 'row',
|
||||
zIndex: 11,
|
||||
height: 50,
|
||||
marginBottom: 10,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
paddingHorizontal: 12,
|
||||
|
||||
@@ -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
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user