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 tabs
ammarahm-edda7d984de368
diff --git a/apps/mobile/initializer.root.js b/apps/mobile/initializer.root.jsindex fe93a4827..3157d1b2c 100644--- a/apps/mobile/initializer.root.js+++ b/apps/mobile/initializer.root.js@@ -1,6 +1,6 @@import {activateKeepAwake,- deactivateKeepAwake,+ deactivateKeepAwake} from '@sayem314/react-native-keep-awake';import React, {useEffect, useRef} from 'react';import {View} from 'react-native';@@ -19,7 +19,7 @@ import {DDS} from './src/services/DeviceDetection';import {eSendEvent,eSubscribeEvent,- eUnSubscribeEvent,+ eUnSubscribeEvent} from './src/services/EventManager';import {editing, setWidthHeight} from './src/utils';import {updateStatusBarColor} from './src/utils/Colors';@@ -27,7 +27,7 @@ import {eClearEditor,eCloseFullscreenEditor,eOnLoadNote,- eOpenFullscreenEditor,+ eOpenFullscreenEditor} from './src/utils/Events';import {editorRef, tabBarRef} from './src/utils/Refs';import {sleep} from './src/utils/TimeUtils';@@ -82,7 +82,7 @@ export const RootView = React.memo(</>);},- () => true,+ () => true);const NativeStack = React.memo(@@ -109,8 +109,8 @@ const NativeStack = React.memo(paddingHorizontal:deviceMode === 'smallTablet'? dimensions.width * 0- : dimensions.width * 0.15,- },+ : dimensions.width * 0.15+ }});};@@ -124,8 +124,8 @@ const NativeStack = React.memo(valueLimiter(dimensions.width * 0.4, 300, 450): dimensions.width * 0.55,zIndex: null,- paddingHorizontal: 0,- },+ paddingHorizontal: 0+ }});if (deviceMode === 'smallTablet') {setTimeout(() => {@@ -166,7 +166,7 @@ const NativeStack = React.memo(function checkDeviceType(size) {setDimensions({width: size.width,- height: size.height,+ height: size.height});setWidthHeight(size);@@ -184,15 +184,15 @@ const NativeStack = React.memo(function setDeviceMode(current, size) {setDeviceModeState(current);let needsUpdate = current !== deviceMode;-+if (fullscreen) {editorRef.current?.setNativeProps({style: {width: size.width,zIndex: 999,paddingHorizontal:- current === 'smallTablet' ? size.width * 0 : size.width * 0.15,- },+ current === 'smallTablet' ? size.width * 0 : size.width * 0.15+ }});} else {editorRef.current?.setNativeProps({@@ -205,8 +205,8 @@ const NativeStack = React.memo(? size.width - valueLimiter(size.width * 0.4, 300, 450): size.width,zIndex: null,- paddingHorizontal: 0,- },+ paddingHorizontal: 0+ }});}if (!needsUpdate) {@@ -218,10 +218,10 @@ const NativeStack = React.memo(tabBarRef.current?.goToIndex(0);} else {if (!editing.movedAway) {- tabBarRef.current?.goToIndex(2)+ tabBarRef.current?.goToIndex(2);} else {- console.log('index one',editing.movedAway);- tabBarRef.current?.goToIndex(1)+ console.log('index one', editing.movedAway);+ tabBarRef.current?.goToIndex(1);}}}, 1);@@ -264,7 +264,7 @@ const NativeStack = React.memo(mobile: {a: dimensions.width * 0.75,b: dimensions.width + dimensions.width * 0.75,- c: dimensions.width * 2 + dimensions.width * 0.75,+ c: dimensions.width * 2 + dimensions.width * 0.75},smallTablet: {a: fullscreen ? 0 : valueLimiter(dimensions.width * 0.3, 300, 350),@@ -273,33 +273,70 @@ const NativeStack = React.memo(: dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350),c: fullscreen? 0- : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350),+ : dimensions.width + valueLimiter(dimensions.width * 0.3, 300, 350)},tablet: {a: 0,b: 0,- c: 0,- },+ c: 0+ }};const widths = {mobile: {a: dimensions.width * 0.75,b: dimensions.width,- c: dimensions.width,+ c: dimensions.width},smallTablet: {a: valueLimiter(dimensions.width * 0.3, 300, 350),b: valueLimiter(dimensions.width * 0.4, 300, 450),- c: dimensions.width - valueLimiter(dimensions.width * 0.4, 300, 450),+ c: dimensions.width - valueLimiter(dimensions.width * 0.4, 300, 450)},tablet: {a: dimensions.width * 0.15,b: dimensions.width * 0.3,- c: dimensions.width * 0.55,- },+ c: dimensions.width * 0.55+ }};+ const listItems = [+ <View+ style={{+ height: '100%',+ width: fullscreen ? 0 : widths[deviceMode].a+ }}>+ <Menu />+ </View>,+ <View+ style={{+ height: '100%',+ width: fullscreen ? 0 : widths[deviceMode].b+ }}>+ {deviceMode === 'mobile' && (+ <Animated.View+ style={{+ position: 'absolute',+ width: '100%',+ height: '100%',+ zIndex: 999,+ backgroundColor: 'rgba(0,0,0,0.2)',+ opacity: animatedOpacity,+ transform: [+ {+ translateY: animatedTranslateY+ }+ ]+ }}+ ref={overlayRef}+ />+ )}++ <NavigatorStack />+ </View>,+ <EditorWrapper width={widths} dimensions={dimensions} />+ ];+return (<ViewonLayout={_onLayout}@@ -307,7 +344,7 @@ const NativeStack = React.memo(style={{width: '100%',height: '100%',- backgroundColor: colors.bg,+ backgroundColor: colors.bg}}>{deviceMode && (<CustomTabs@@ -315,49 +352,14 @@ const NativeStack = React.memo(dimensions={dimensions}widths={widths[deviceMode]}style={{- zIndex: 1,+ zIndex: 1}}initialIndex={deviceMode === 'smallTablet' || deviceMode === 'tablet' ? 0 : 1}toggleOverlay={toggleView}offsets={offsets[deviceMode]}- items={[- <View- style={{- height: '100%',- width: fullscreen ? 0 : widths[deviceMode].a,- }}>- <Menu />- </View>,- <View- style={{- height: '100%',- width: fullscreen ? 0 : widths[deviceMode].b,- }}>- {deviceMode === 'mobile' && (- <Animated.View- style={{- position: 'absolute',- width: '100%',- height: '100%',- zIndex: 999,- backgroundColor: 'rgba(0,0,0,0.2)',- opacity: animatedOpacity,- transform: [- {- translateY: animatedTranslateY,- },- ],- }}- ref={overlayRef}- />- )}-- <NavigatorStack />- </View>,- <EditorWrapper width={widths} dimensions={dimensions} />,- ]}+ items={listItems}onScroll={onScroll}onChangeTab={onChangeTab}/>@@ -365,5 +367,5 @@ const NativeStack = React.memo(</View>);},- () => true,+ () => true);diff --git a/apps/mobile/src/components/CustomTabs/index.js b/apps/mobile/src/components/CustomTabs/index.jsindex c97701678..555d09a52 100644--- a/apps/mobile/src/components/CustomTabs/index.js+++ b/apps/mobile/src/components/CustomTabs/index.js@@ -1,6 +1,6 @@import React, {Component, createRef} from 'react';import {Platform} from 'react-native';-import { Keyboard } from 'react-native';+import {Keyboard} from 'react-native';import {FlatList, TextInput, View} from 'react-native';import {DDS} from '../../services/DeviceDetection';import {editing} from '../../utils';@@ -91,6 +91,10 @@ export default class CustomTabs extends Component {}goToIndex(index, animated = true) {+ if (this.scrollEndTimeout) {+ clearTimeout(this.scrollEndTimeout);+ this.scrollEndTimeout = null;+ }let offset = 0;if (index === 1) {this.nextPage = 0;@@ -105,14 +109,14 @@ export default class CustomTabs extends Component {this.listRef.current?.scrollToOffset({offset: offset,- animated: animated,+ animated: animated});}setScrollEnabled = enabled => {this.scrollEnabled = enabled;this.listRef.current?.getNativeScrollRef().setNativeProps({- scrollEnabled: enabled,+ scrollEnabled: enabled});};@@ -151,6 +155,10 @@ export default class CustomTabs extends Component {};goToPage = page => {+ if (this.scrollEndTimeout) {+ clearTimeout(this.scrollEndTimeout);+ this.scrollEndTimeout = null;+ }this.nextPage = page;if (page === 0) {this.scrollOffset = this.props.offsets.a;@@ -171,7 +179,7 @@ export default class CustomTabs extends Component {onScrollEnd = () => {if (this.scrollEndTimeout) {- clearTimeout(this.scrollEndTimeout)+ clearTimeout(this.scrollEndTimeout);this.scrollEndTimeout = null;}this.moved = false;@@ -193,13 +201,13 @@ export default class CustomTabs extends Component {this.props.toggleOverlay(Math.floor(this.scrollOffset) < Math.floor(this.props.offsets.a - 10)? true- : false,+ : false);if (this.page !== page) {this.scrollEndTimeout = setTimeout(() => {this.props.onChangeTab({i: page, from: this.page});this.page = page;- },50)+ }, 50);}};@@ -220,7 +228,7 @@ export default class CustomTabs extends Component {onMoveShouldSetResponderCapture={this.onMoveShouldSetResponder}onStartShouldSetResponderCapture={this.onMoveShouldSetResponder}style={{- flex: 1,+ flex: 1}}><TextInputref={this.inputElement}@@ -246,7 +254,6 @@ export default class CustomTabs extends Component {overScrollMode="never"maxToRenderPerBatch={100}keyboardDismissMode="none"- disableVirtualizationremoveClippedSubviews={Platform.OS === 'android'}keyboardShouldPersistTaps="always"showsHorizontalScrollIndicator={false}@@ -256,10 +263,10 @@ export default class CustomTabs extends Component {snapToOffsets={[this.props.offsets.a,this.props.offsets.b,- this.props.offsets.c,+ this.props.offsets.c]}contentOffset={{- x: editing.movedAway ? this.props.offsets.a : this.props.offsets.b,+ x: editing.movedAway ? this.props.offsets.a : this.props.offsets.b}}data={['drawer', 'navigation', 'editor']}renderItem={this.renderItem}@@ -270,5 +277,5 @@ export default class CustomTabs extends Component {}CustomTabs.defaultProps = {- onDrawerStateChange: () => {},+ onDrawerStateChange: () => {}};diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.jsindex f47880cd5..28bdd8ad9 100644--- a/apps/mobile/src/views/Editor/EditorHeader.js+++ b/apps/mobile/src/views/Editor/EditorHeader.js@@ -108,7 +108,7 @@ const EditorHeader = () => {await clearEditor();Keyboard.removeListener('keyboardDidShow', tiny.onKeyboardShow);}- }, 50);+ }, 300);};const publishNote = async () => {