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 animations
ammarahm-ed8e30291a6afc
diff --git a/apps/mobile/src/components/SearchInput/index.js b/apps/mobile/src/components/SearchInput/index.jsindex ae8776f6f..d06d9600f 100644--- a/apps/mobile/src/components/SearchInput/index.js+++ b/apps/mobile/src/components/SearchInput/index.js@@ -12,6 +12,8 @@ import {TextInput, Text} from 'react-native';const {Value, timing, block} = Animated;let offsetY = 0;let searchResult = [];+let timeoutAnimate = null;+export const Search = props => {const [state, dispatch] = useTracked();const {colors, searchResults} = state;@@ -25,22 +27,45 @@ export const Search = props => {const _opacity = new Value(1);const _borderAnim = new Value(1.5);+ const animation = (margin, opacity, border) => {+ timing(_marginAnim, {+ toValue: margin,+ duration: 230,+ easing: Easing.inOut(Easing.ease),+ }).start();+ timing(_opacity, {+ toValue: opacity,+ duration: 250,+ easing: Easing.inOut(Easing.ease),+ }).start();+ timing(_borderAnim, {+ toValue: border,+ duration: 270,+ easing: Easing.inOut(Easing.ease),+ }).start();+ };+const onScroll = y => {if (searchResults.results.length > 0) return;if (y < 30) {- setHideHeader(false);+ animation(0, 1, 1.5);offsetY = y;}-if (y > offsetY) {if (y - offsetY < 100) return;-- setHideHeader(true);+ clearTimeout(timeoutAnimate);+ timeoutAnimate = null;+ timeoutAnimate = setTimeout(() => {+ animation(-65, 0, 0);+ }, 500);offsetY = y;} else {if (offsetY - y < 50) return;-- setHideHeader(false);+ clearTimeout(timeoutAnimate);+ timeoutAnimate = null;+ timeoutAnimate = setTimeout(() => {+ animation(0, 1, 1.5);+ }, 500);offsetY = y;}};@@ -49,38 +74,17 @@ export const Search = props => {selection.data = searchState.data;selection.type = searchState.type;eSubscribeEvent(eScrollEvent, onScroll);-eSubscribeEvent('showSearch', () => {- setHideHeader(false);+ animation(0, 1, 1.5);});return () => {eUnSubscribeEvent(eScrollEvent, onScroll);-eUnSubscribeEvent('showSearch', () => {- setHideHeader(false);+ animation(0, 1, 1.5);});};- }, []);-- useEffect(() => {- timing(_marginAnim, {- toValue: hideHeader ? -65 : 0,- duration: 230,- easing: Easing.inOut(Easing.ease),- }).start();- timing(_opacity, {- toValue: hideHeader ? 0 : 1,- duration: 250,- easing: Easing.inOut(Easing.ease),- }).start();- timing(_borderAnim, {- toValue: hideHeader ? 0 : 1.5,- duration: 270,- easing: Easing.inOut(Easing.ease),- }).start();- console.log('called');- }, [hideHeader]);+ }, [searchState]);const clearSearch = () => {if (searchResult && searchResult.length > 0) {diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.jsindex e08c0436e..b8b7e5ab0 100644--- a/apps/mobile/src/components/header/index.js+++ b/apps/mobile/src/components/header/index.js@@ -27,7 +27,7 @@ import {moveNoteHideEvent} from '../DialogManager/recievers';import {HeaderMenu} from './HeaderMenu';import {HeaderTitle} from './HeaderTitle';let offsetY = 0;-+let timeout = nullfunction useForceUpdate() {const [, setTick] = useState(0);const update = useCallback(() => {@@ -53,26 +53,37 @@ export const Header = ({showSearch, root}) => {const insets = useSafeArea();const forceUpdate = useForceUpdate();+const onScroll = y => {if (searchResults.results.length > 0) return;if (y < 30) {setHideHeader(false);- offsetY = y;+ offsetY = y}-if (y > offsetY) {if (y - offsetY < 100) return;-- setHideHeader(true);- offsetY = y;+ clearTimeout(timeout);+ timeout = null+ timeout = setTimeout(() => {+ setHideHeader(true);+ },300);+ offsetY = y} else {if (offsetY - y < 50) return;-- setHideHeader(false);- offsetY = y;+ clearTimeout(timeout);+ timeout = null+ timeout = setTimeout(() => {+ setHideHeader(false);+ },300);+ offsetY = y+}+};+++const _setModalNavigator = value => {if (root) return;forceUpdate();@@ -92,7 +103,7 @@ export const Header = ({showSearch, root}) => {<Viewstyle={{flexDirection: 'row',- zIndex: 10,+ zIndex: 11,height: 50,marginTop:Platform.OS === 'ios'@@ -107,6 +118,7 @@ export const Header = ({showSearch, root}) => {alignItems: 'center',paddingHorizontal: 12,width: '100%',+ backgroundColor:colors.bg}}><Animatable.Viewtransition={['opacity']}diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex cb3e492d4..e35a9b2c5 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -60,13 +60,7 @@ const Editor = ({noMenu}) => {post('theme', colors);}, [colors.bg]);- useEffect(() => {- if (noMenu) {- //post('nomenu', true);- } else {- //post('nomenu', false);- }- }, [noMenu]);+useEffect(() => {eSubscribeEvent(eOnLoadNote, load);@@ -146,7 +140,9 @@ const Editor = ({noMenu}) => {if (checkNote()) {ToastEvent.show('Note Saved!', 'success');}- await clearEditor();+ setTimeout(async () => {+ await clearEditor();+ }, 300);if (handleBack) {handleBack.remove();handleBack = null;@@ -184,7 +180,7 @@ const Editor = ({noMenu}) => {color={colors.icon}onPress={_onBackPress}customStyle={{- marginLeft:-5+ marginLeft: -5,}}/>)}diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.jsindex 6c75de30a..93093f652 100755--- a/apps/mobile/src/views/Home/index.js+++ b/apps/mobile/src/views/Home/index.js@@ -8,7 +8,7 @@ import {eSendEvent} from '../../services/eventManager';import {eOnLoadNote, eScrollEvent} from '../../services/events';import {openEditorAnimation} from '../../utils/animations';import {DDS} from '../../utils/utils';-import { Placeholder } from '../../components/ListPlaceholders';+import {Placeholder} from '../../components/ListPlaceholders';export const Home = ({route, navigation}) => {const [state, dispatch] = useTracked();@@ -97,7 +97,7 @@ export const Home = ({route, navigation}) => {pinned={true}focused={isFocused}RenderItem={NoteItemWrapper}- placeholder={<Placeholder type="notes"/>}+ placeholder={<Placeholder type="notes" />}placeholderText={`Notes you write appear here`}/></>