Skip to content

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

ui: fix side menu and marginTop on android.

ammarahm-edfa9b9e12f7ee
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 4f11404cf..580ca3ad3 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -37,6 +37,10 @@ const App = () => {
const [isOpen, setOpen] = useState(false);
const [disableGestures, setDisableGesture] = useState(false);
const [isIntialized, setIsInitialized] = useState(false);
+ const [overlay, setOverlay] = useState(false);
+
+ // Variables
+ let timer = null;
// Effects
useEffect(() => {
@@ -151,7 +155,9 @@ const App = () => {
})
}
onChange={args => {
- setTimeout(() => {
+ clearTimeout(timer);
+ timer = null;
+ timer = setTimeout(() => {
setOpen(args);
}, 300);
}}
diff --git a/apps/mobile/src/components/EditorMenu/index.js b/apps/mobile/src/components/EditorMenu/index.js
index 88f356da5..728167d32 100644
--- a/apps/mobile/src/components/EditorMenu/index.js
+++ b/apps/mobile/src/components/EditorMenu/index.js
@@ -246,7 +246,8 @@ export const EditorMenu = ({
height: 2,
width: '100%',
marginBottom: 5,
- marginTop: Platform.OS == 'ios' ? 0 : 45,
+ marginTop:
+ Platform.OS == 'ios' ? 0 : StatusBar.currentHeight - 10,
}}
/>
<FlatList
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index 2253fe037..55cd9cdc3 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -6,6 +6,7 @@ import {
TouchableOpacity,
Platform,
FlatList,
+ StatusBar,
} from 'react-native';
import NavigationService from '../../services/NavigationService';
import {
@@ -39,7 +40,7 @@ export const Menu = ({close = () => {}, hide, update = () => {}}) => {
height: 2,
width: '100%',
marginBottom: 5,
- marginTop: Platform.OS == 'ios' ? 0 : 45,
+ marginTop: Platform.OS == 'ios' ? 0 : StatusBar.currentHeight - 10,
}}
/>
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js
index 81b5be2fc..69846c3a5 100644
--- a/apps/mobile/src/components/NotesList/index.js
+++ b/apps/mobile/src/components/NotesList/index.js
@@ -195,7 +195,7 @@ export const NotesList = ({
marginTop:
Platform.OS == 'ios'
? notes[0]
- ? 175
+ ? 135
: 135 - 60
: notes[0]
? 175
@@ -235,84 +235,3 @@ export const NotesList = ({
/>
);
};
-
-/*
- <FlatList
- data={notes}
- keyExtractor={(item, index) => item.dateCreated.toString()}
- ListFooterComponent={
- <View
- style={{
- height: 150,
- alignItems: 'center',
- justifyContent: 'center',
- }}>
- <Text
- style={{
- color: colors.navbg,
- fontSize: SIZE.sm,
- fontFamily: WEIGHT.regular,
- }}>
- - End -
- </Text>
- </View>
- }
- onScroll={event => {
- y = event.nativeEvent.contentOffset.y;
- onScroll(y);
- }}
- ListHeaderComponent={
- <View
- style={{
- marginTop: 185,
- }}></View>
- }
- numColumns={numColumns}
- key={numColumns}
- columnWrapperStyle={
- numColumns === 1
- ? null
- : {
- width:
- notes.length === 1
- ? DDS.isTab
- ? '95%'
- : '90%'
- : DDS.isTab
- ? '45%'
- : '42.5%',
- }
- }
- contentContainerStyle={{
- width:
- numColumns === 2
- ? DDS.isTab
- ? '100%'
- : null
- : DDS.isTab
- ? '95%'
- : '90%',
- alignItems: numColumns === 2 ? 'flex-start' : null,
- alignSelf: 'center',
- }}
- ListFooterComponent={
- <View
- style={{
- height: 150,
- alignItems: 'center',
- justifyContent: 'center',
- }}>
- <Text
- style={{
- color: colors.navbg,
- fontSize: SIZE.sm,
- fontFamily: WEIGHT.regular,
- }}>
- - End -
- </Text>
- </View>
- }
- renderItem={({item, index}) => (
- <NoteItem item={item} numColumns={numColumns} index={index} />
- )}
- /> */
diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.js
index 82c3d987a..0dbc7bd9f 100644
--- a/apps/mobile/src/components/header/index.js
+++ b/apps/mobile/src/components/header/index.js
@@ -1,5 +1,5 @@
import React, {useEffect, useState} from 'react';
-import {View, TouchableOpacity, Platform, Text} from 'react-native';
+import {View, TouchableOpacity, Platform, Text, StatusBar} from 'react-native';
import Icon from 'react-native-vector-icons/Feather';
import {SIZE, WEIGHT} from '../../common/common';
import {h, SideMenuEvent, getElevation} from '../../utils/utils';
@@ -27,7 +27,7 @@ export const Header = ({
flexDirection: 'row',
zIndex: 10,
height: 50,
- marginTop: Platform.OS === 'ios' ? 0 : 45,
+ marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,
marginBottom: 10,
justifyContent: 'space-between',
alignItems: 'center',
diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.js
index eed367130..68c2ebf11 100755
--- a/apps/mobile/src/views/Editor/index.js
+++ b/apps/mobile/src/views/Editor/index.js
@@ -32,6 +32,7 @@ let titleRef;
let EditorWebView;
let timer = null;
let note = {};
+
const Editor = ({navigation}) => {
// Global State
const {colors} = useAppContext();
@@ -52,7 +53,7 @@ const Editor = ({navigation}) => {
// VARIABLES
let updateInterval = null;
let lastTextChange = 0;
-
+ let menuTimer = null;
// FUNCTIONS
const post = value => EditorWebView.postMessage(value);
@@ -73,11 +74,7 @@ const Editor = ({navigation}) => {
console.log(content.text, timestamp, title);
timestamp = await db.addNote({
- tags: noteProps.tags,
- colors: noteProps.colors,
- pinned: noteProps.pinned,
- favorite: noteProps.favorite,
- locked: noteProps.locked,
+ ...noteProps,
title,
content: {
text: content.text,
@@ -355,7 +352,9 @@ const Editor = ({navigation}) => {
if (noteProps.locked) {
db.lockNote(timestamp, 'password');
}
- setTimeout(() => {
+ clearTimeout(menuTimer);
+ menuTimer = null;
+ menuTimer = setTimeout(() => {
setOpen(args);
}, 500);
}}