mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
remove SearchInput
This commit is contained in:
@@ -22,13 +22,13 @@ function onTitleChange() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (titleMessage && typeof titleMessage.value === 'string') {
|
if (titleMessage && typeof titleMessage.value === 'string') {
|
||||||
//window.ReactNativeWebView.postMessage(JSON.stringify(titleMessage));
|
window.ReactNativeWebView.postMessage(JSON.stringify(titleMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachEditorListeners() {
|
function attachEditorListeners() {
|
||||||
editor.once('text-change', function () {
|
editor.once('text-change', function () {
|
||||||
//window.ReactNativeWebView.postMessage('loaded');
|
window.ReactNativeWebView.postMessage('loaded');
|
||||||
let text = editor.getText();
|
let text = editor.getText();
|
||||||
document.getElementById('infowords').innerText =
|
document.getElementById('infowords').innerText =
|
||||||
text.split(' ').length + ' words';
|
text.split(' ').length + ' words';
|
||||||
@@ -203,6 +203,6 @@ function attachEditorListeners() {
|
|||||||
m.text.split(' ').length + ' words';
|
m.text.split(' ').length + ' words';
|
||||||
m.html = editor.root.innerHTML;
|
m.html = editor.root.innerHTML;
|
||||||
m.type = 'content';
|
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 Animated, {Easing, useValue} from 'react-native-reanimated';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Header} from '../Header';
|
import {Header} from '../Header';
|
||||||
import {Search} from '../SearchInput';
|
|
||||||
|
|
||||||
export const ContainerTopSection = ({root}) => {
|
export const ContainerTopSection = ({root}) => {
|
||||||
const [state,] = useTracked();
|
const [state,] = useTracked();
|
||||||
@@ -25,10 +24,7 @@ export const ContainerTopSection = ({root}) => {
|
|||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
zIndex: 998,
|
|
||||||
display: 'flex',
|
|
||||||
width: '100%',
|
width: '100%',
|
||||||
opacity: opacity,
|
opacity: opacity,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
@@ -38,10 +34,7 @@ export const ContainerTopSection = ({root}) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
|
|
||||||
<Header root={root} />
|
<Header root={root} />
|
||||||
<Search root={root} />
|
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {KeyboardAvoidingView, Platform, SafeAreaView} from 'react-native';
|
import {KeyboardAvoidingView, Platform, SafeAreaView} from 'react-native';
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
||||||
import SelectionHeader from '../SelectionHeader';
|
import SelectionHeader from '../SelectionHeader';
|
||||||
import {ContainerTopSection} from './ContainerTopSection';
|
import {ContainerTopSection} from './ContainerTopSection';
|
||||||
|
|
||||||
export const Container = ({children, root}) => {
|
export const Container = ({children, root}) => {
|
||||||
const insets = useSafeAreaInsets()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView behavior="padding" enabled={Platform.OS === 'ios'}>
|
||||||
behavior="padding"
|
|
||||||
enabled={Platform.OS === 'ios'}>
|
|
||||||
<SafeAreaView
|
<SafeAreaView
|
||||||
style={{
|
style={{
|
||||||
height: '100%',
|
height: '100%',
|
||||||
paddingTop: insets.top,
|
|
||||||
}}>
|
}}>
|
||||||
<SelectionHeader />
|
<SelectionHeader />
|
||||||
<ContainerTopSection root={root} />
|
<ContainerTopSection root={root} />
|
||||||
|
|||||||
@@ -3,50 +3,30 @@ import {ActivityIndicator, Platform, StyleSheet, View} from 'react-native';
|
|||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {eSendEvent, eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
import {
|
||||||
|
eSendEvent,
|
||||||
|
eSubscribeEvent,
|
||||||
|
eUnSubscribeEvent,
|
||||||
|
} from '../../services/EventManager';
|
||||||
import {dWidth} from '../../utils';
|
import {dWidth} from '../../utils';
|
||||||
import {ActionIcon} from '../ActionIcon';
|
import {ActionIcon} from '../ActionIcon';
|
||||||
import {HeaderMenu} from './HeaderMenu';
|
import {HeaderMenu} from './HeaderMenu';
|
||||||
import {HeaderTitle} from './HeaderTitle';
|
import {HeaderTitle} from './HeaderTitle';
|
||||||
import {SIZE} from "../../utils/SizeUtils";
|
import {SIZE} from '../../utils/SizeUtils';
|
||||||
import {HeaderLeftMenu} from "./HeaderLeftMenu";
|
import {HeaderLeftMenu} from './HeaderLeftMenu';
|
||||||
import {eScrollEvent} from '../../utils/Events';
|
import {eScrollEvent} from '../../utils/Events';
|
||||||
|
|
||||||
let timeout = null;
|
|
||||||
export const Header = ({root}) => {
|
export const Header = ({root}) => {
|
||||||
const [state, ] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors, syncing} = state;
|
const {colors, syncing} = state;
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const [hideHeader,setHideHeader] = useState(false);
|
const [hide, setHide] = useState(false);
|
||||||
|
|
||||||
const {
|
|
||||||
searchResults,
|
|
||||||
} = state;
|
|
||||||
let offsetY = 0;
|
|
||||||
|
|
||||||
|
|
||||||
const onScroll = (y) => {
|
const onScroll = (y) => {
|
||||||
if (searchResults.results.length > 0) return;
|
if (y > 3) {
|
||||||
if (y < 30) {
|
setHide(false);
|
||||||
setHideHeader(false);
|
|
||||||
offsetY = y;
|
|
||||||
}
|
|
||||||
if (y > offsetY) {
|
|
||||||
if (y - offsetY < 100) return;
|
|
||||||
clearTimeout(timeout);
|
|
||||||
timeout = null;
|
|
||||||
timeout = setTimeout(() => {
|
|
||||||
setHideHeader(true);
|
|
||||||
}, 300);
|
|
||||||
offsetY = y;
|
|
||||||
} else {
|
} else {
|
||||||
if (offsetY - y < 50) return;
|
setHide(true);
|
||||||
clearTimeout(timeout);
|
|
||||||
timeout = null;
|
|
||||||
timeout = setTimeout(() => {
|
|
||||||
setHideHeader(false);
|
|
||||||
}, 300);
|
|
||||||
offsetY = y;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,6 +45,8 @@ export const Header = ({ root}) => {
|
|||||||
marginTop: insets.top,
|
marginTop: insets.top,
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
borderBottomColor: hide ? 'transparent' : colors.nav,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<View style={styles.leftBtnContainer}>
|
<View style={styles.leftBtnContainer}>
|
||||||
@@ -94,13 +76,6 @@ export const Header = ({ root}) => {
|
|||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
||||||
<View style={styles.rightBtnContainer}>
|
<View style={styles.rightBtnContainer}>
|
||||||
<Animatable.View
|
|
||||||
transition="opacity"
|
|
||||||
useNativeDriver={true}
|
|
||||||
duration={500}
|
|
||||||
style={{
|
|
||||||
opacity: hideHeader ? 1 : 0,
|
|
||||||
}}>
|
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!hideHeader) return;
|
if (!hideHeader) return;
|
||||||
@@ -108,12 +83,10 @@ export const Header = ({ root}) => {
|
|||||||
eSendEvent('showSearch');
|
eSendEvent('showSearch');
|
||||||
}}
|
}}
|
||||||
name="magnify"
|
name="magnify"
|
||||||
size={SIZE.xl}
|
size={SIZE.xxxl}
|
||||||
color={colors.pri}
|
color={colors.pri}
|
||||||
style={styles.rightBtn}
|
style={styles.rightBtn}
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -124,7 +97,6 @@ const styles = StyleSheet.create({
|
|||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
zIndex: 11,
|
zIndex: 11,
|
||||||
height: 50,
|
height: 50,
|
||||||
marginBottom: 10,
|
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
useWindowDimensions,
|
useWindowDimensions,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
|
import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
@@ -52,7 +51,6 @@ const SimpleList = ({
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
const {width, fontScale} = useWindowDimensions();
|
const {width, fontScale} = useWindowDimensions();
|
||||||
const insets = useSafeAreaInsets();
|
|
||||||
|
|
||||||
const listData = data;
|
const listData = data;
|
||||||
const dataType = type;
|
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 ? (
|
return !listData || listData.length === 0 || !dataProvider ? (
|
||||||
_ListEmptyComponent
|
_ListEmptyComponent
|
||||||
) : (
|
) : (
|
||||||
@@ -266,7 +248,12 @@ const SimpleList = ({
|
|||||||
minHeight: '100%',
|
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(eOnLoadNote, load);
|
||||||
eSubscribeEvent(eCloseFullscreenEditor, closeFullscreen);
|
eSubscribeEvent(eCloseFullscreenEditor, closeFullscreen);
|
||||||
eSubscribeEvent(eClearEditor, onCallClear);
|
eSubscribeEvent(eClearEditor, onCallClear);
|
||||||
Keyboard.addListener("keyboardDidShow",() => {
|
|
||||||
post("keyboard")
|
|
||||||
})
|
|
||||||
return () => {
|
return () => {
|
||||||
eUnSubscribeEvent(eClearEditor, onCallClear);
|
eUnSubscribeEvent(eClearEditor, onCallClear);
|
||||||
eUnSubscribeEvent(eCloseFullscreenEditor, closeFullscreen);
|
eUnSubscribeEvent(eCloseFullscreenEditor, closeFullscreen);
|
||||||
eUnSubscribeEvent(eOnLoadNote, load);
|
eUnSubscribeEvent(eOnLoadNote, load);
|
||||||
Keyboard.removeListener("keyboardDidShow",() => {
|
|
||||||
post("keyboard")
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -84,6 +80,9 @@ const EditorHeader = ({noMenu}) => {
|
|||||||
}, [noMenu]);
|
}, [noMenu]);
|
||||||
|
|
||||||
const load = async (item) => {
|
const load = async (item) => {
|
||||||
|
Keyboard.addListener("keyboardDidShow",() => {
|
||||||
|
post("keyboard")
|
||||||
|
})
|
||||||
await loadNote(item);
|
await loadNote(item);
|
||||||
if (item.type === 'new') {
|
if (item.type === 'new') {
|
||||||
textInput.current?.focus();
|
textInput.current?.focus();
|
||||||
@@ -139,6 +138,9 @@ const EditorHeader = ({noMenu}) => {
|
|||||||
ToastEvent.show('Note Saved!', 'success');
|
ToastEvent.show('Note Saved!', 'success');
|
||||||
}
|
}
|
||||||
await clearEditor();
|
await clearEditor();
|
||||||
|
Keyboard.removeListener("keyboardDidShow",() => {
|
||||||
|
post("keyboard")
|
||||||
|
})
|
||||||
if (handleBack) {
|
if (handleBack) {
|
||||||
handleBack.remove();
|
handleBack.remove();
|
||||||
handleBack = null;
|
handleBack = null;
|
||||||
|
|||||||
@@ -332,8 +332,6 @@ const loadNoteInEditor = async () => {
|
|||||||
await sleep(50);
|
await sleep(50);
|
||||||
post('title', title);
|
post('title', title);
|
||||||
post('delta', content.delta);
|
post('delta', content.delta);
|
||||||
} else {
|
|
||||||
post('focusTitle');
|
|
||||||
}
|
}
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
post('clearHistory');
|
post('clearHistory');
|
||||||
|
|||||||
Reference in New Issue
Block a user