A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix small bug
ammarahm-ed69ce4e921aea
diff --git a/apps/mobile/src/components/Container/ContainerTopSection.js b/apps/mobile/src/components/Container/ContainerTopSection.jsindex 7a880d460..c9f0426f9 100644--- a/apps/mobile/src/components/Container/ContainerTopSection.js+++ b/apps/mobile/src/components/Container/ContainerTopSection.js@@ -19,7 +19,7 @@ export const ContainerTopSection = ({root}) => {display: selectionMode ? 'none' : 'flex',width: '100%',}}>- <Header root={root} />+ <Header root={root} /><Search root={root} /></Animatable.View>diff --git a/apps/mobile/src/components/SearchInput/index.js b/apps/mobile/src/components/SearchInput/index.jsindex 5eeacafea..ae8776f6f 100644--- a/apps/mobile/src/components/SearchInput/index.js+++ b/apps/mobile/src/components/SearchInput/index.js@@ -5,30 +5,28 @@ import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';import {eClearSearch, eScrollEvent} from '../../services/events';import {inputRef} from '../../utils/refs';import {db, DDS, selection, ToastEvent} from '../../utils/utils';-import Animated,{Easing} from "react-native-reanimated";+import Animated, {Easing} from 'react-native-reanimated';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import { br, WEIGHT, SIZE } from '../../common/common';-import { TextInput } from 'react-native';+import {br, WEIGHT, SIZE} from '../../common/common';+import {TextInput, Text} from 'react-native';const {Value, timing, block} = Animated;let offsetY = 0;let searchResult = [];export const Search = props => {const [state, dispatch] = useTracked();- const {colors} = state;+ const {colors, searchResults} = state;const [text, setText] = useState('');const [focus, setFocus] = useState(false);const [hideHeader, setHideHeader] = useState(false);- let searchState = props.root? state.searchState : state.indSearchState;-+ let searchState = props.root ? state.searchState : state.indSearchState;+const _marginAnim = new Value(0);const _opacity = new Value(1);const _borderAnim = new Value(1.5);--const onScroll = y => {- if (searchResult.length > 0) return;+ if (searchResults.results.length > 0) return;if (y < 30) {setHideHeader(false);offsetY = y;@@ -52,34 +50,43 @@ export const Search = props => {selection.type = searchState.type;eSubscribeEvent(eScrollEvent, onScroll);+ eSubscribeEvent('showSearch', () => {+ setHideHeader(false);+ });+return () => {eUnSubscribeEvent(eScrollEvent, onScroll);++ eUnSubscribeEvent('showSearch', () => {+ setHideHeader(false);+ });};}, []);useEffect(() => {timing(_marginAnim, {- toValue: props.hide ? -65 : 0,+ toValue: hideHeader ? -65 : 0,duration: 230,easing: Easing.inOut(Easing.ease),}).start();timing(_opacity, {- toValue: props.hide ? 0 : 1,+ toValue: hideHeader ? 0 : 1,duration: 250,easing: Easing.inOut(Easing.ease),}).start();timing(_borderAnim, {- toValue: props.hide ? 0 : 1.5,+ toValue: hideHeader ? 0 : 1.5,duration: 270,easing: Easing.inOut(Easing.ease),}).start();+ console.log('called');}, [hideHeader]);const clearSearch = () => {if (searchResult && searchResult.length > 0) {searchResult = null;- setText(null);-+ setText(null);+inputRef.current?.setNativeProps({text: '',});@@ -110,11 +117,11 @@ export const Search = props => {clearSearch();return;}- let type = searchState.type+ let type = searchState.type;if (!type) return;let data = searchState.data;-+searchResult = await db.lookup[type](data[0].data ? db.notes.all : data,text,diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.jsindex af411def8..c58e5943a 100644--- a/apps/mobile/src/components/header/index.js+++ b/apps/mobile/src/components/header/index.js@@ -1,31 +1,18 @@-import React, {useEffect, useState, createRef, useCallback} from 'react';-import {- Platform,- TouchableOpacity,- View,- ActivityIndicator,-} from 'react-native';+import React, { useCallback, useEffect, useState } from 'react';+import { ActivityIndicator, Platform, TouchableOpacity, View } from 'react-native';import * as Animatable from 'react-native-animatable';-import {useSafeArea} from 'react-native-safe-area-context';-import {useTracked} from '../../provider';-import {- eSubscribeEvent,- eUnSubscribeEvent,- eSendEvent,-} from '../../services/eventManager';-import {- eScrollEvent,- eSetModalNavigator,- eCloseLoginDialog,-} from '../../services/events';-import {DDS, selection, w} from '../../utils/utils';-import {HeaderMenu} from './HeaderMenu';-import {HeaderTitle} from './HeaderTitle';+import { useSafeArea } from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {SIZE} from '../../common/common';-import {sideMenuRef} from '../../utils/refs';+import { SIZE } from '../../common/common';+import { useTracked } from '../../provider';+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/eventManager';+import { eCloseLoginDialog, eScrollEvent, eSetModalNavigator } from '../../services/events';import NavigationService from '../../services/NavigationService';-import {moveNoteHideEvent} from '../DialogManager/recievers';+import { sideMenuRef } from '../../utils/refs';+import { DDS, w } from '../../utils/utils';+import { moveNoteHideEvent } from '../DialogManager/recievers';+import { HeaderMenu } from './HeaderMenu';+import { HeaderTitle } from './HeaderTitle';let offsetY = 0;function useForceUpdate() {@@ -215,7 +202,7 @@ export const Header = ({showSearch, root}) => {opacity: hideHeader ? 1 : 0,}}><TouchableOpacity- onPress={() => showSearch()}+ onPress={() => eSendEvent('showSearch')}style={{justifyContent: 'center',alignItems: 'flex-end',