Skip to content

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

cleanup

ammarahm-ed4ecd8e8d461a
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index db0e0a467..2867f1a18 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -1,11 +1,8 @@
import React, {useEffect, useState} from 'react';
-import * as Animatable from 'react-native-animatable';
import MMKV from 'react-native-mmkv-storage';
import Orientation from 'react-native-orientation';
import {Loading} from './Loading';
import {getColorScheme, scale, updateSize} from './src/common/common';
-import {DialogManager} from './src/components/DialogManager';
-import {Toast} from './src/components/Toast';
import {useTracked} from './src/provider';
import {ACTIONS} from './src/provider/actions';
import {defaultState} from './src/provider/defaultState';
@@ -17,7 +14,6 @@ const I = DDS.isTab ? require('./index.tablet') : require('./index.mobile');
const App = () => {
const [state, dispatch] = useTracked();
- const {colors} = state;
const [init, setInit] = useState(false);
const _onOrientationChange = o => {
@@ -81,20 +77,8 @@ const App = () => {
}
return (
<>
- <Animatable.View
- transition="backgroundColor"
- duration={300}
- style={{
- width: '100%',
- height: '100%',
- flexDirection: 'row',
- backgroundColor: colors.bg,
- }}>
- <Loading />
- <I.Initialize />
- <Toast />
- <DialogManager colors={colors} />
- </Animatable.View>
+ <I.Initialize />
+ <Loading />
</>
);
};
diff --git a/apps/mobile/index.mobile.js b/apps/mobile/index.mobile.js
index efbb87547..db347942e 100644
--- a/apps/mobile/index.mobile.js
+++ b/apps/mobile/index.mobile.js
@@ -1,6 +1,7 @@
-import React, {useEffect} from 'react';
+import React, {useEffect, createRef} from 'react';
import Animated from 'react-native-reanimated';
import {Menu} from './src/components/Menu';
+import * as Animatable from 'react-native-animatable';
import SideMenu from './src/components/SideMenu';
import NavigationService, {
AppContainer,
@@ -12,7 +13,7 @@ import Editor from './src/views/Editor';
import {useTracked} from './src/provider';
import {StatusBar, Platform} from 'react-native';
-let editorRef;
+const editorRef = createRef();
export const Initialize = () => {
const [state, dispatch] = useTracked();
const {colors} = state;
@@ -25,7 +26,15 @@ export const Initialize = () => {
}
}, []);
return (
- <>
+ <Animatable.View
+ transition="backgroundColor"
+ duration={300}
+ style={{
+ width: '100%',
+ height: '100%',
+ flexDirection: 'row',
+ backgroundColor: colors.bg,
+ }}>
<SideMenu
ref={sideMenuRef}
bounceBackOnOverdraw={false}
@@ -56,7 +65,7 @@ export const Initialize = () => {
</SideMenu>
<Animated.View
- ref={ref => (editorRef = ref)}
+ ref={editorRef}
onResponderTerminationRequest={true}
onStartShouldSetResponderCapture={false}
onStartShouldSetResponder={false}
@@ -77,6 +86,6 @@ export const Initialize = () => {
}}>
<Editor noMenu={false} />
</Animated.View>
- </>
+ </Animatable.View>
);
};
diff --git a/apps/mobile/index.tablet.js b/apps/mobile/index.tablet.js
index d4988c1ba..1144d96d3 100644
--- a/apps/mobile/index.tablet.js
+++ b/apps/mobile/index.tablet.js
@@ -1,15 +1,15 @@
-import React, {useEffect} from 'react';
-import {View, Platform, StatusBar} from 'react-native';
+import React, {createRef, useEffect} from 'react';
+import {Platform, StatusBar, View} from 'react-native';
import * as Animatable from 'react-native-animatable';
import {Menu} from './src/components/Menu';
import {ModalMenu} from './src/components/ModalMenu';
+import {useTracked} from './src/provider';
import NavigationService, {
AppContainer,
} from './src/services/NavigationService';
import Editor from './src/views/Editor';
-import {useTracked} from './src/provider';
-let editorRef;
+const editorRef = createRef();
let outColors;
export const Initialize = () => {
@@ -25,7 +25,7 @@ export const Initialize = () => {
const showFullScreenEditor = () => {
setFullscreen(true);
- editorRef.setNativeProps({
+ editorRef.current?.setNativeProps({
style: {
position: 'absolute',
width: '100%',
@@ -38,7 +38,7 @@ export const Initialize = () => {
const closeFullScreenEditor = () => {
setFullscreen(false);
- editorRef.setNativeProps({
+ editorRef.current?.setNativeProps({
style: {
position: 'relative',
width: '68%',
@@ -68,7 +68,15 @@ export const Initialize = () => {
}, []);
return (
- <>
+ <Animatable.View
+ transition="backgroundColor"
+ duration={300}
+ style={{
+ width: '100%',
+ height: '100%',
+ flexDirection: 'row',
+ backgroundColor: colors.bg,
+ }}>
<ModalMenu colors={colors} />
<Animatable.View
animation="fadeIn"
@@ -100,7 +108,7 @@ export const Initialize = () => {
/>
</Animatable.View>
<View
- ref={ref => (editorRef = ref)}
+ ref={editorRef}
style={{
width: '68%',
height: '100%',
@@ -108,6 +116,6 @@ export const Initialize = () => {
}}>
<Editor noMenu={fullscreen ? false : true} />
</View>
- </>
+ </Animatable.View>
);
};
diff --git a/apps/mobile/loading.js b/apps/mobile/loading.js
index f153f7bee..ece7219e4 100755
--- a/apps/mobile/loading.js
+++ b/apps/mobile/loading.js
@@ -3,6 +3,8 @@ import {SIZE, WEIGHT} from './src/common/common';
import * as Animatable from 'react-native-animatable';
import {useTracked} from './src/provider';
import {w} from './src/utils/utils';
+import {DialogManager} from './src/components/DialogManager';
+import {Toast} from './src/components/Toast';
export const Loading = () => {
const [state, dispatch] = useTracked();
@@ -98,6 +100,8 @@ export const Loading = () => {
e to write
</Animatable.Text>
</Animatable.View>
+ <Toast />
+ <DialogManager colors={colors} />
</>
);
};