Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

remove loading screen

ammarahm-edbe4ee2d2577e
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index d7157d952..130b9c9a3 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -10,6 +10,8 @@ import {eSubscribeEvent, eUnSubscribeEvent} from './src/services/eventManager';
import {eDispatchAction, eStartSyncer} from './src/services/events';
import {db, DDS} from './src/utils/utils';
import {SafeAreaProvider} from 'react-native-safe-area-context';
+import { Toast } from './src/components/Toast';
+import { DialogManager } from './src/components/DialogManager';
const App = () => {
const [state, dispatch] = useTracked();
@@ -54,7 +56,7 @@ const App = () => {
dispatch({type: ACTIONS.USER, user: u});
dispatch({type: ACTIONS.ALL});
dispatch({type: ACTIONS.SYNCING, syncing: false});
- }
+ };
useEffect(() => {
eSubscribeEvent(eStartSyncer, startSyncer);
@@ -63,7 +65,7 @@ const App = () => {
db.ev.unsubscribe('sync', _syncFunc);
eUnSubscribeEvent(eStartSyncer, startSyncer);
};
- },[]);
+ }, []);
useEffect(() => {
Initialize().then(() => {
@@ -110,12 +112,14 @@ const App = () => {
return <></>;
}
return (
- <SafeAreaProvider>
- <>
- <I.Initialize />
- <Loading />
- </>
- </SafeAreaProvider>
+ <>
+ <SafeAreaProvider>
+ <>
+ <I.Initialize />
+ </>
+ </SafeAreaProvider>
+
+ </>
);
};
diff --git a/apps/mobile/index.mobile.js b/apps/mobile/index.mobile.js
index 3f0450c64..d07f6ae2c 100644
--- a/apps/mobile/index.mobile.js
+++ b/apps/mobile/index.mobile.js
@@ -6,18 +6,24 @@ import Animated from 'react-native-reanimated';
import {Menu} from './src/components/Menu';
import {useTracked} from './src/provider';
import {NavigationStack} from './src/services/Navigator';
-import {EditorOpacity, EditorPosition, EditorScale} from './src/utils/animations';
+import {
+ EditorOpacity,
+ EditorPosition,
+ EditorScale,
+} from './src/utils/animations';
import {sideMenuRef} from './src/utils/refs';
import {DDS} from './src/utils/utils';
import Editor from './src/views/Editor';
-import { eSubscribeEvent, eUnSubscribeEvent } from './src/services/eventManager';
-import { eOpenSideMenu, eCloseSideMenu } from './src/services/events';
+import {eSubscribeEvent, eUnSubscribeEvent} from './src/services/eventManager';
+import {eOpenSideMenu, eCloseSideMenu} from './src/services/events';
+import { Toast } from './src/components/Toast';
+import { DialogManager } from './src/components/DialogManager';
const editorRef = createRef();
export const Initialize = () => {
const [state, dispatch] = useTracked();
const {colors} = state;
- const [locked,setLocked] = useState(false);
+ const [locked, setLocked] = useState(false);
useEffect(() => {
if (Platform.OS === 'android') {
@@ -27,89 +33,93 @@ export const Initialize = () => {
}
}, []);
- const setGestureDisabled = () =>{
+ const setGestureDisabled = () => {
setLocked(true);
- }
+ };
const setGestureEnabled = () => {
setLocked(false);
- }
+ };
useEffect(() => {
- eSubscribeEvent(eOpenSideMenu,setGestureEnabled);
- eSubscribeEvent(eCloseSideMenu,setGestureDisabled);
+ eSubscribeEvent(eOpenSideMenu, setGestureEnabled);
+ eSubscribeEvent(eCloseSideMenu, setGestureDisabled);
return () => {
- eUnSubscribeEvent(eOpenSideMenu,setGestureEnabled);
- eUnSubscribeEvent(eCloseSideMenu,setGestureDisabled);
- }
- },[])
+ eUnSubscribeEvent(eOpenSideMenu, setGestureEnabled);
+ eUnSubscribeEvent(eCloseSideMenu, setGestureDisabled);
+ };
+ }, []);
return (
- <Animatable.View
- transition="backgroundColor"
- duration={300}
- style={{
- width: '100%',
- height: '100%',
- flexDirection: 'row',
- backgroundColor: colors.bg,
- }}>
- <DrawerLayout
- ref={sideMenuRef}
+ <>
+ <Animatable.View
+ transition="backgroundColor"
+ duration={300}
style={{
- opacity: 0,
+ width: '100%',
+ height: '100%',
+ flexDirection: 'row',
backgroundColor: colors.bg,
- }}
- keyboardDismissMode="ondrag"
- drawerWidth={300}
- drawerLockMode={locked? "locked-closed" : 'unlocked'}
- useNativeAnimations={true}
- renderNavigationView={() => (
- <Menu
- hide={false}
- colors={colors}
- close={() => sideMenuRef.current?.closeDrawer()}
- />
- )}>
- <View
+ }}>
+ <DrawerLayout
+ ref={sideMenuRef}
+ style={{
+ opacity: 0,
+ backgroundColor: colors.bg,
+ }}
+ keyboardDismissMode="ondrag"
+ drawerWidth={300}
+ drawerLockMode={locked ? 'locked-closed' : 'unlocked'}
+ useNativeAnimations={true}
+ renderNavigationView={() => (
+ <Menu
+ hide={false}
+ colors={colors}
+ close={() => sideMenuRef.current?.closeDrawer()}
+ />
+ )}>
+ <View
+ style={{
+ width: DDS.isTab ? '70%' : '100%',
+ height: '100%',
+ backgroundColor: colors.bg,
+ }}>
+ <NavigationStack />
+ </View>
+ </DrawerLayout>
+
+ <Animated.View
+ ref={editorRef}
+ onResponderTerminationRequest={true}
+ onStartShouldSetResponderCapture={false}
+ onStartShouldSetResponder={false}
+ onMoveShouldSetResponder={false}
+ onMoveShouldSetResponderCapture={false}
style={{
- width: DDS.isTab ? '70%' : '100%',
+ width: '100%',
height: '100%',
+ alignSelf: 'flex-end',
+ position: 'absolute',
backgroundColor: colors.bg,
+ elevation: 10,
+ opacity: EditorOpacity,
+ transform: [
+ {
+ translateX: EditorPosition,
+ },
+ {
+ scaleX: EditorScale,
+ },
+ {
+ scaleY: EditorScale,
+ },
+ ],
}}>
- <NavigationStack />
- </View>
- </DrawerLayout>
-
- <Animated.View
- ref={editorRef}
- onResponderTerminationRequest={true}
- onStartShouldSetResponderCapture={false}
- onStartShouldSetResponder={false}
- onMoveShouldSetResponder={false}
- onMoveShouldSetResponderCapture={false}
- style={{
- width: '100%',
- height: '100%',
- alignSelf: 'flex-end',
- position: 'absolute',
- backgroundColor: colors.bg,
- elevation: 10,
- opacity: EditorOpacity,
- transform: [
- {
- translateX: EditorPosition,
- },
- {
- scaleX:EditorScale,
- },
- {
- scaleY:EditorScale
- }
- ],
- }}>
- <Editor noMenu={false} />
- </Animated.View>
- </Animatable.View>
+ <Editor noMenu={false} />
+ </Animated.View>
+ </Animatable.View>
+ <Toast />
+ <DialogManager colors={colors} />
+ </>
);
};
diff --git a/apps/mobile/index.tablet.js b/apps/mobile/index.tablet.js
index 82ea1a13b..37e18ff12 100644
--- a/apps/mobile/index.tablet.js
+++ b/apps/mobile/index.tablet.js
@@ -18,6 +18,8 @@ import Editor from './src/views/Editor';
import {sideMenuRef} from './src/utils/refs';
import DrawerLayout from 'react-native-drawer-layout';
import {getElevation} from './src/utils/utils';
+import {Toast} from './src/components/Toast';
+import {DialogManager} from './src/components/DialogManager';
const editorRef = createRef();
let outColors;
@@ -26,7 +28,6 @@ export const Initialize = () => {
const [state, dispatch] = useTracked();
const {colors} = state;
-
const [fullscreen, setFullscreen] = useState(false);
useEffect(() => {
@@ -82,66 +83,68 @@ export const Initialize = () => {
}, []);
return (
- <DrawerLayout
- ref={sideMenuRef}
- style={{
- opacity: 0,
- backgroundColor: colors.bg,
- }}
- keyboardDismissMode="ondrag"
- drawerWidth={300}
- useNativeAnimations={true}
- renderNavigationView={() => (
- <Menu
- hide={false}
- colors={colors}
- close={() => sideMenuRef.current?.closeDrawer()}
- />
- )}>
- <Animatable.View
- transition="backgroundColor"
- duration={300}
+ <>
+ <DrawerLayout
+ ref={sideMenuRef}
style={{
- width: '100%',
- height: '100%',
- flexDirection: 'row',
+ opacity: 0,
backgroundColor: colors.bg,
- }}>
-
- <Animatable.View
- animation="fadeIn"
- useNativeDriver={true}
- duration={500}
- delay={450}
- style={{
- width: '4%',
- }}>
- <Menu
-
- hide={false} noTextMode={true} colors={colors} />
- </Animatable.View>
+ }}
+ keyboardDismissMode="ondrag"
+ drawerWidth={300}
+ useNativeAnimations={true}
+ renderNavigationView={() => (
+ <Menu
+ hide={false}
+ colors={colors}
+ close={() => sideMenuRef.current?.closeDrawer()}
+ />
+ )}>
<Animatable.View
transition="backgroundColor"
duration={300}
style={{
- width: '28%',
+ width: '100%',
height: '100%',
- borderRightColor: colors.nav,
- borderRightWidth: 2,
+ flexDirection: 'row',
+ backgroundColor: colors.bg,
}}>
- <NavigationStack />
+ <Animatable.View
+ animation="fadeIn"
+ useNativeDriver={true}
+ duration={500}
+ delay={450}
+ style={{
+ width: '4%',
+ }}>
+ <Menu hide={false} noTextMode={true} colors={colors} />
+ </Animatable.View>
+ <Animatable.View
+ transition="backgroundColor"
+ duration={300}
+ style={{
+ width: '28%',
+ height: '100%',
+ borderRightColor: colors.nav,
+ borderRightWidth: 2,
+ }}>
+ <NavigationStack />
+ </Animatable.View>
+
+ <View
+ ref={editorRef}
+ style={{
+ width: '68%',
+ height: '100%',
+ backgroundColor: 'transparent',
+ }}>
+ <Editor noMenu={fullscreen ? false : true} />
+ </View>
</Animatable.View>
+ </DrawerLayout>
- <View
- ref={editorRef}
- style={{
- width: '68%',
- height: '100%',
- backgroundColor: 'transparent',
- }}>
- <Editor noMenu={fullscreen ? false : true} />
- </View>
- </Animatable.View>
- </DrawerLayout>
+ <Toast />
+ <DialogManager colors={colors} />
+ </>
);
};