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
refactor progress circle
ammarahm-ed5a8f2b291193
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.jsindex 0abe3bc58..69ba86ed0 100644--- a/apps/mobile/src/views/Editor/EditorHeader.js+++ b/apps/mobile/src/views/Editor/EditorHeader.js@@ -52,6 +52,7 @@ import tiny, {safeKeyboardDismiss} from './tiny/tiny';import {toolbarRef} from './tiny/toolbar/constants';import * as Progress from 'react-native-progress';+import { ProgressCircle } from './ProgressCircle';const EditorHeader = () => {const [state] = useTracked();const {colors} = state;@@ -62,12 +63,10 @@ const EditorHeader = () => {const fullscreen = useSettingStore(state => state.fullscreen);const user = useUserStore(state => state.user);const insets = useSafeAreaInsets();- const loading = useAttachmentStore(state => state.loading);const handleBack = useRef();const keyboardListener = useRef();useEffect(() => {- console.log(loading);setColors(colors);}, [colors]);@@ -76,7 +75,7 @@ const EditorHeader = () => {eSendEvent(eCloseFullscreenEditor);return;}-+if (deviceMode === 'mobile') {editing.movedAway = true;}@@ -201,7 +200,10 @@ const EditorHeader = () => {const load = async item => {await loadNote(item);InteractionManager.runAfterInteractions(() => {- keyboardListener.current = Keyboard.addListener('keyboardDidShow', tiny.onKeyboardShow);+ keyboardListener.current = Keyboard.addListener(+ 'keyboardDidShow',+ tiny.onKeyboardShow+ );if (!DDS.isTab) {handleBack.current = BackHandler.addEventListener('hardwareBackPress',@@ -237,7 +239,6 @@ const EditorHeader = () => {};const _onHardwareBackPress = async () => {-if (editing.currentlyEditing) {await _onBackPress();return true;@@ -268,7 +269,6 @@ const EditorHeader = () => {{deviceMode !== 'mobile' && !fullscreen ? null : (<ActionIcononLongPress={async () => {-await _onBackPress();Navigation.popToTop();}}@@ -332,26 +332,7 @@ const EditorHeader = () => {onPress={showActionsheet}/>- {loading && loading.current !== loading.total ? (- <View- style={{- justifyContent: 'center',- marginLeft: 10- }}>- <Progress.Circle- size={SIZE.xxl}- progress={1}- showsText- textStyle={{- fontSize: 8- }}- color={colors.accent}- formatText={progress => (progress * 100).toFixed(0)}- borderWidth={0}- thickness={2}- />- </View>- ) : null}+ <ProgressCircle/></></View></View>diff --git a/apps/mobile/src/views/Editor/ProgressCircle.js b/apps/mobile/src/views/Editor/ProgressCircle.jsnew file mode 100644index 000000000..9f9540fed--- /dev/null+++ b/apps/mobile/src/views/Editor/ProgressCircle.js@@ -0,0 +1,30 @@+import React from 'react';+import {View} from 'react-native';+import * as Progress from 'react-native-progress';+import {useAttachmentStore} from '../../provider/stores';+import {SIZE} from '../../utils/SizeUtils';++export const ProgressCircle = () => {+ const loading = useAttachmentStore(state => state.loading);++ return loading && loading.current !== loading.total ? (+ <View+ style={{+ justifyContent: 'center',+ marginLeft: 10+ }}>+ <Progress.Circle+ size={SIZE.xxl}+ progress={1}+ showsText+ textStyle={{+ fontSize: 8+ }}+ color={colors.accent}+ formatText={progress => (progress * 100).toFixed(0)}+ borderWidth={0}+ thickness={2}+ />+ </View>+ ) : null;+};