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 issues with layout animations
ammarahm-ed5ea20eaf65a7
diff --git a/apps/mobile/index.js b/apps/mobile/index.jsindex 41c68e27b..446769c38 100644--- a/apps/mobile/index.js+++ b/apps/mobile/index.js@@ -1,14 +1,15 @@-import 'react-native-gesture-handler';import React from 'react';-import {AppRegistry, LogBox, Platform} from 'react-native';-import {name as appName} from './app.json';-import {enableScreens} from 'react-native-screens';+import { AppRegistry, LayoutAnimation, LogBox, Platform, UIManager } from 'react-native';+import 'react-native-gesture-handler';+import { SafeAreaProvider } from 'react-native-safe-area-context';+import { enableScreens } from 'react-native-screens';+import { name as appName } from './app.json';import Notifications from './src/services/Notifications';-import {SafeAreaProvider} from 'react-native-safe-area-context';global.Buffer = require('buffer').Buffer;enableScreens(true);+UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);-LogBox.ignoreAllLogs();+//LogBox.ignoreAllLogs();let Provider;let App;diff --git a/apps/mobile/src/components/Sheet/index.js b/apps/mobile/src/components/Sheet/index.jsindex 8dcbc11b8..d40519fd3 100644--- a/apps/mobile/src/components/Sheet/index.js+++ b/apps/mobile/src/components/Sheet/index.js@@ -74,7 +74,7 @@ const SheetWrapper = ({indicatorColor={colors.nav}onOpen={_onOpen}keyboardDismissMode="none"- overlayColor={pitchBlack? '#585858' : colors.nav}+ overlayColor={pitchBlack? '#585858' : "#000000"}keyboardShouldPersistTaps="always"ExtraOverlayComponent={<>diff --git a/apps/mobile/src/components/TagsDialog/index.js b/apps/mobile/src/components/TagsDialog/index.jsindex 8e490725c..cc50e025f 100644--- a/apps/mobile/src/components/TagsDialog/index.js+++ b/apps/mobile/src/components/TagsDialog/index.js@@ -44,7 +44,9 @@ const TagsDialog = () => {}, []);useEffect(() => {- sortTags();+ if (visible) {+ sortTags();+ }}, [allTags, note, query]);const sortTags = () => {diff --git a/apps/mobile/src/provider/stores.ts b/apps/mobile/src/provider/stores.tsindex 2e166c672..e52454018 100644--- a/apps/mobile/src/provider/stores.ts+++ b/apps/mobile/src/provider/stores.ts@@ -249,7 +249,7 @@ export const useSettingStore = create<SettingStore>((set, get) => ({devMode: false,notifNotes: false,pitchBlack: false,- reduceAnimations:false+ reduceAnimations: false},sheetKeyboardHandler: true,fullscreen: false,@@ -341,7 +341,10 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({history.selectedItemsList = [];history.selectionMode = false;}- layoutmanager.withSpringAnimation(500);+ console.log('call set selection mode');+ if (mode !== get().selectionMode) {+ layoutmanager.withSpringAnimation(500);+ }set({selectionMode: mode,selectedItemsList: mode ? get().selectedItemsList : []@@ -361,7 +364,11 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({history.selectionMode =selectedItems.length > 0 ? get().selectionMode : false;+ console.log('called selected items');+ if (get().selectionMode !== history.selectionMode) {layoutmanager.withSpringAnimation(500);+ }+set({selectedItemsList: selectedItems,selectionMode: history.selectionMode@@ -370,7 +377,10 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({clearSelection: () => {history.selectedItemsList = [];history.selectionMode = false;- layoutmanager.withSpringAnimation(500);+ console.log('called clear selection');+ if (get().selectionMode !== history.selectionMode) {+ layoutmanager.withSpringAnimation(500);+ }set({selectionMode: false, selectedItemsList: []});}}));@@ -385,8 +395,12 @@ export const useMessageStore = create<MessageStore>((set, get) => ({icon: 'account-outline'},setMessage: message => {+ console.log('setting message');setTimeout(() => {- layoutmanager.withAnimation();+ if (get().message.visible || message.visible) {+ layoutmanager.withAnimation();+ }+set({message: {...message}});}, 1);},@@ -421,6 +435,7 @@ export const useMessageStore = create<MessageStore>((set, get) => ({setTimeout(() => {if (all.filter(a => a.type === 'inline').length !== 0) {+ console.log('with setAnnouncement ');layoutmanager.withAnimation();}set({diff --git a/apps/mobile/src/utils/layoutmanager.js b/apps/mobile/src/utils/layoutmanager.jsindex 4f45e8cad..cd218a9a4 100644--- a/apps/mobile/src/utils/layoutmanager.js+++ b/apps/mobile/src/utils/layoutmanager.js@@ -3,6 +3,12 @@ import SettingsService from '../services/SettingsService';const {LayoutAnimation} = require('react-native');function withAnimation(duration = 300) {+ // try {+ // throw new Error('error withAnimation')+ // } catch(e) {+ // console.log(e.stack);+ // }+ console.log('reduce withAnimation: ',SettingsService.get().reduceAnimations)if (SettingsService.get().reduceAnimations) return;LayoutAnimation.configureNext(LayoutAnimation.create(duration, 'linear', 'opacity')@@ -10,6 +16,13 @@ function withAnimation(duration = 300) {}function withSpringAnimation(duration = 300) {+ // try {+ // throw new Error('error withSpringAnimation')+ // } catch(e) {+ // console.log(e.stack);+ // }++ console.log('reduce withSpringAnimation: ',SettingsService.get().reduceAnimations)if (SettingsService.get().reduceAnimations) return;LayoutAnimation.configureNext({duration: duration,diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.jsindex 7e199fa9b..1edfe3c49 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js@@ -33,8 +33,10 @@ const Tooltip = () => {properties.userBlur = true;if (!data) {editing.tooltip = null;- layoutmanager.withAnimation(150);- setGroup(null);+ if (group) {+ layoutmanager.withAnimation(150);+ setGroup(null);+ }return;}if (!data) return;