Skip to content

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

make day/night animations faster

ammarahm-ed5c9b94c04e83
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index fbe099f69..064b042c0 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -25,7 +25,13 @@ import {
_recieveEvent,
_unSubscribeEvent,
} from './src/components/DialogManager';
-import {getColorScheme} from './src/common/common';
+import {
+ getColorScheme,
+ COLOR_SCHEME,
+ onThemeUpdate,
+ clearThemeUpdateListener,
+ COLOR_SCHEME_DARK,
+} from './src/common/common';
import Editor from './src/views/Editor';
import {ModalMenu} from './src/components/ModalMenu';
@@ -49,22 +55,20 @@ let editorRef;
const App = () => {
const [state, dispatch] = useTracked();
const {colors} = state;
+
const [width, setWidth] = useState(w);
// Local State
const [init, setInit] = useState(false);
const [fullscreen, setFullscreen] = useState(false);
- let animatedSidebarWidth = new Value(w * 0.04);
- let animatedAppContainerWidth = new Value(w * 0.96);
- let isShown = true;
// Effects
const openSidebar = () => {
- DDS.isTab ? sidebarAnimation() : sideMenuRef.openMenu(true);
+ DDS.isTab ? null : sideMenuRef.openMenu(true);
};
const closeSidebar = () => {
- DDS.isTab ? sidebarAnimation() : sideMenuRef.openMenu(false);
+ DDS.isTab ? null : sideMenuRef.openMenu(false);
};
const disableGestures = () => {
@@ -76,6 +80,7 @@ const App = () => {
};
useEffect(() => {
+ console.log(colors);
_recieveEvent('openSidebar', openSidebar);
_recieveEvent('closeSidebar', closeSidebar);
@@ -105,7 +110,6 @@ const App = () => {
width: '100%',
zIndex: 999,
paddingHorizontal: 100,
- backgroundColor: colors.bg,
},
});
};
@@ -118,7 +122,6 @@ const App = () => {
width: '68%',
zIndex: null,
paddingHorizontal: 0,
- backgroundColor: 'transparent',
},
});
};
@@ -150,45 +153,12 @@ const App = () => {
});
}, []);
- async function updateAppTheme(colors = state.colors) {
+ async function updateAppTheme(colors = colors) {
let newColors = await getColorScheme(colors);
dispatch({type: ACTIONS.THEME, colors: newColors});
+ //setColors(newColors);
}
- const sidebarAnimation = () => {
- let sValue;
- let aValue;
- if (isShown) {
- sValue = w * 0.04;
- aValue = w * 0.96;
- isShown = false;
- } else {
- sValue = w * 0.25;
- aValue = w * 0.75;
- isShown = true;
- }
-
- let _anim = timing(animatedSidebarWidth, {
- duration: 200,
- toValue: sValue,
- easing: Easing.in(Easing.ease),
- });
-
- let _animS = timing(animatedAppContainerWidth, {
- duration: 0,
- toValue: aValue,
- easing: Easing.inOut(Easing.ease),
- });
-
- if (isShown) {
- _animS.start();
- _anim.start();
- } else {
- _anim.start();
- _animS.start();
- }
- };
-
// Render
if (!init) {
@@ -226,7 +196,9 @@ const App = () => {
/>
</View>
- <View
+ <Animatable.View
+ transition="backgroundColor"
+ duration={300}
style={{
width: '28%',
height: '100%',
@@ -242,7 +214,7 @@ const App = () => {
NavigationService.setTopLevelNavigator(navigatorRef);
}}
/>
- </View>
+ </Animatable.View>
<View
ref={ref => (editorRef = ref)}
diff --git a/apps/mobile/android/app/src/main/assets/texteditor.html b/apps/mobile/android/app/src/main/assets/texteditor.html
index 06bf909ac..471f964b0 100644
--- a/apps/mobile/android/app/src/main/assets/texteditor.html
+++ b/apps/mobile/android/app/src/main/assets/texteditor.html
@@ -1281,13 +1281,13 @@ const setTheme = function() {
}
.ql-container.ql-snow {
border: 1px solid ${pageTheme.colors.nav};
+ background-color:transparent;
}
- .ql-toolbar {
- background-color:${pageTheme.colors.bg};
- border-top: 1px solid ${pageTheme.colors.nav};
- }
+
.ql-toolbar {
+ background-color:transparent;
+ border-top: 1px solid ${pageTheme.colors.nav};
overflow-x: auto;
width: 100vw;
white-space: nowrap;
@@ -1316,7 +1316,7 @@ const setTheme = function() {
border-color:${pageTheme.colors.nav};
}
.ql-container {
- background-color:${pageTheme.colors.bg};
+
color:${pageTheme.colors.pri};
}
diff --git a/apps/mobile/src/common/common.js b/apps/mobile/src/common/common.js
index 72d811bab..59a0b5485 100755
--- a/apps/mobile/src/common/common.js
+++ b/apps/mobile/src/common/common.js
@@ -114,6 +114,7 @@ export async function getColorScheme() {
}
DeviceEventEmitter.emit('onThemeUpdate');
+
return COLOR_SCHEME;
}
diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index 75a3f3aff..65f8b9254 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -67,7 +67,7 @@ export const Container = ({
style={{
height: '100%',
- backgroundColor: colors.night ? colors.bg : colors.bg,
+ backgroundColor: colors.bg,
}}>
<KeyboardAvoidingView
behavior="padding"
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index bddaa3202..6809b87c8 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -117,6 +117,8 @@ export const Menu = ({
opacity: hide ? 0 : 1,
backgroundColor: colors.shade,
width: '100%',
+ borderRightWidth: noTextMode ? 1 : 0,
+ borderRightColor: noTextMode ? colors.accent : 'transparent',
}}>
<View
style={{
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index 823b457c7..a99c36b1d 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -278,7 +278,6 @@ const Editor = ({navigation, noMenu}) => {
style={{
height: '100%',
width: '100%',
- backgroundColor: 'transparent',
}}>
<View
style={{
@@ -447,8 +446,8 @@ const Editor = ({navigation, noMenu}) => {
Platform.OS === 'ios'
? sourceUri
: {
- uri: 'file:///android_asset/texteditor.html',
- baseUrl: 'file:///android_asset/',
+ uri: 'http://192.168.10.7:8080/texteditor.html',
+ baseUrl: 'http://192.168.10.7:8080',
}
}
style={{
@@ -509,7 +508,7 @@ const Editor = ({navigation, noMenu}) => {
duration={300}
style={{
flex: 1,
- backgroundColor: colors.bg,
+ backgroundColor: 'transparent',
height: '100%',
width: '100%',
flexDirection: 'row',