Skip to content

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

some fixes in UI for tablet

ammarahm-ed798f1083ed96
diff --git a/apps/mobile/index.tablet.js b/apps/mobile/index.tablet.js
index 6de0760b6..82ea1a13b 100644
--- a/apps/mobile/index.tablet.js
+++ b/apps/mobile/index.tablet.js
@@ -1,14 +1,23 @@
-import React, { createRef, useEffect, useState } from 'react';
-import { Platform, StatusBar, View } from 'react-native';
+import React, {createRef, useEffect, useState} 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 { eSendEvent, eSubscribeEvent } from './src/services/eventManager';
-import { eCloseFullscreenEditor, eOnLoadNote, eOpenFullscreenEditor } from './src/services/events';
-import { NavigationStack } from './src/services/Navigator';
+import {Menu} from './src/components/Menu';
+import {useTracked} from './src/provider';
+import {
+ eSendEvent,
+ eSubscribeEvent,
+ eUnSubscribeEvent,
+} from './src/services/eventManager';
+import {
+ eCloseFullscreenEditor,
+ eOnLoadNote,
+ eOpenFullscreenEditor,
+} from './src/services/events';
+import {NavigationStack} from './src/services/Navigator';
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';
const editorRef = createRef();
let outColors;
@@ -17,6 +26,7 @@ export const Initialize = () => {
const [state, dispatch] = useTracked();
const {colors} = state;
+
const [fullscreen, setFullscreen] = useState(false);
useEffect(() => {
@@ -66,50 +76,72 @@ export const Initialize = () => {
StatusBar.setBackgroundColor('transparent');
StatusBar.setTranslucent(true);
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
+ } else {
+ StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
}
}, []);
return (
- <Animatable.View
- transition="backgroundColor"
- duration={300}
+ <DrawerLayout
+ ref={sideMenuRef}
style={{
- width: '100%',
- height: '100%',
- flexDirection: 'row',
+ opacity: 0,
backgroundColor: colors.bg,
- }}>
- <ModalMenu colors={colors} />
- <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>
- <View
- ref={editorRef}
- style={{
- width: '68%',
- height: '100%',
- backgroundColor: 'transparent',
- }}>
- <Editor noMenu={fullscreen ? false : true} />
- </View>
- </Animatable.View>
+ </DrawerLayout>
);
};
diff --git a/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj b/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj
index 4f041e67a..e2434fff8 100644
--- a/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj
+++ b/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj
@@ -755,6 +755,7 @@
PRODUCT_NAME = Notesnook;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
@@ -776,6 +777,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook;
PRODUCT_NAME = Notesnook;
SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
diff --git a/apps/mobile/ios/Notesnook/Info.plist b/apps/mobile/ios/Notesnook/Info.plist
index b8f44bc79..f36287116 100644
--- a/apps/mobile/ios/Notesnook/Info.plist
+++ b/apps/mobile/ios/Notesnook/Info.plist
@@ -60,9 +60,9 @@
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
- <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
+ <string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
diff --git a/apps/mobile/ios/Podfile.lock b/apps/mobile/ios/Podfile.lock
index 3338869e4..a06a4f547 100644
--- a/apps/mobile/ios/Podfile.lock
+++ b/apps/mobile/ios/Podfile.lock
@@ -315,7 +315,7 @@ PODS:
- React
- RNReanimated (1.8.0):
- React
- - RNScreens (1.0.0-alpha.23):
+ - RNScreens (2.7.0):
- React
- RNShare (3.3.0):
- React
@@ -531,7 +531,7 @@ SPEC CHECKSUMS:
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38
RNReanimated: 955cf4068714003d2f1a6e2bae3fb1118f359aff
- RNScreens: f28b48b8345f2f5f39ed6195518291515032a788
+ RNScreens: cf198f915f8a2bf163de94ca9f5bfc8d326c3706
RNShare: fea1801315aa8875d6db73a4010b14afcd568765
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
Yoga: 3ebccbdd559724312790e7742142d062476b698e
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index daaea27f7..310aabdc9 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -1,42 +1,17 @@
-import React, {useEffect} from 'react';
-import {
- Platform,
- SafeAreaView,
- ScrollView,
- StatusBar,
- Text,
- TouchableOpacity,
- View,
- ActivityIndicator,
-} from 'react-native';
+import React, { useEffect } from 'react';
+import { ActivityIndicator, Platform, SafeAreaView, ScrollView, StatusBar, Text, TouchableOpacity, View } from 'react-native';
+import { createAnimatableComponent } from 'react-native-animatable';
import MMKV from 'react-native-mmkv-storage';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import {
- ACCENT,
- COLOR_SCHEME,
- COLOR_SCHEME_DARK,
- COLOR_SCHEME_LIGHT,
- normalize,
- opacity,
- ph,
- pv,
- setColorScheme,
- SIZE,
- WEIGHT,
-} from '../../common/common';
-import {useTracked} from '../../provider';
-import {ACTIONS} from '../../provider/actions';
-import {eSendEvent} from '../../services/eventManager';
-import {
- eClearSearch,
- eOpenModalMenu,
- refreshNotesPage,
-} from '../../services/events';
+import { ACCENT, COLOR_SCHEME, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT, normalize, opacity, ph, pv, setColorScheme, SIZE, WEIGHT } from '../../common/common';
+import { useTracked } from '../../provider';
+import { ACTIONS } from '../../provider/actions';
+import { eSendEvent } from '../../services/eventManager';
+import { eClearSearch, refreshNotesPage, eOpenLoginDialog } from '../../services/events';
import NavigationService from '../../services/NavigationService';
-import {db, DDS, hexToRGBA, timeSince, ToastEvent} from '../../utils/utils';
-import {sideMenuOverlayRef} from '../../utils/refs';
-import {createAnimatableComponent} from 'react-native-animatable';
-import {TimeSince} from './TimeSince';
+import { sideMenuRef } from '../../utils/refs';
+import { db, DDS, hexToRGBA, ToastEvent } from '../../utils/utils';
+import { TimeSince } from './TimeSince';
const AnimatedSafeAreaView = createAnimatableComponent(SafeAreaView);
@@ -45,6 +20,7 @@ export const Menu = ({
hide,
update = () => {},
noTextMode = false,
+ onButtonLongPress = () => {}
}) => {
const [state, dispatch] = useTracked();
const {colors, tags, colorNotes, user, currentScreen, syncing} = state;
@@ -132,7 +108,7 @@ export const Menu = ({
width: '100%',
backgroundColor: colors.bg,
borderRightWidth: noTextMode ? 1 : 0,
- borderRightColor: noTextMode ? colors.accent : 'transparent',
+ borderRightColor: noTextMode ? colors.nav : 'transparent',
}}>
<View
style={{
@@ -156,7 +132,7 @@ export const Menu = ({
{DDS.isTab && noTextMode ? (
<TouchableOpacity
onPress={() => {
- eSendEvent(eOpenModalMenu);
+ sideMenuRef.current?.openDrawer()
}}
style={{
alignItems: 'center',
diff --git a/apps/mobile/src/components/ModalMenu/index.js b/apps/mobile/src/components/ModalMenu/index.js
deleted file mode 100644
index 852b751f8..000000000
--- a/apps/mobile/src/components/ModalMenu/index.js
+++ /dev/null
@@ -1,106 +0,0 @@
-import React, {Component} from 'react';
-import {Modal, TouchableOpacity, View} from 'react-native';
-import * as Animatable from 'react-native-animatable';
-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';
-import {eOpenModalMenu} from '../../services/events';
-import {getElevation, w} from '../../utils/utils';
-import {Menu} from '../Menu';
-
-export class ModalMenu extends Component {
- constructor(props) {
- super(props);
- this.state = {
- visible: false,
- showMenu: false,
- };
- }
-
- componentDidMount() {
- eSubscribeEvent(eOpenModalMenu, this.show);
- }
-
- componentWillUnmount() {
- eUnSubscribeEvent(eOpenModalMenu, this.show);
- }
-
- _onClose = () => {
- this.setState({
- visible: false,
- });
- };
-
- show = () => {
- this.setState({
- visible: true,
- });
- };
- hide = () => {
- this.setState(
- {
- showMenu: false,
- },
- () => {
- setTimeout(() => {
- this.setState({
- visible: 'false',
- });
- }, 100);
- },
- );
- };
-
- render() {
- const {colors} = this.props;
- const {visible, showMenu} = this.state;
- return (
- <Modal
- visible={visible}
- transparent={true}
- animated={false}
- onShow={() => {
- setTimeout(() => {
- this.setState({
- showMenu: true,
- });
- }, 0);
- }}
- onRequestClose={() => this.setState({visible: false})}>
- <View
- style={{
- width: '100%',
- height: '100%',
- backgroundColor: 'rgba(0,0,0,0.2)',
- justifyContent: 'center',
- alignItems: 'flex-start',
- }}>
- <TouchableOpacity
- onPress={this.hide}
- style={{
- width: '100%',
- height: '100%',
- position: 'absolute',
- }}
- />
- <Animatable.View
- transition={['translateX']}
- useNativeDriver={true}
- duration={300}
- style={{
- ...getElevation(10),
- width: 300,
- height: '100%',
- backgroundColor: colors.bg,
- zIndex: 10,
- transform: [
- {
- translateX: showMenu ? 0 : -w,
- },
- ],
- }}>
- <Menu hasCloseButton={true} noTextMode={false} close={this.hide} />
- </Animatable.View>
- </View>
- </Modal>
- );
- }
-}
diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.js
index 1b566cb77..c6a19faef 100644
--- a/apps/mobile/src/components/header/index.js
+++ b/apps/mobile/src/components/header/index.js
@@ -46,7 +46,7 @@ export const Header = ({
height: 50,
marginTop:
Platform.OS === 'ios'
- ? insets.top
+ ? preventDefaultMargins || isLoginNavigator? 0 : insets.top
: preventDefaultMargins || isLoginNavigator
? 0
: insets.top,