Skip to content

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

switch to small tab ui in landscape on mobile

ammarahm-ed5f2739822ce8
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index dd7365fad..bdbaa9605 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -92,7 +92,7 @@ const App = () => {
const _onOrientationChange = (o) => {
return;
- let smallTab = DDS.isSmallTab;
+ /* let smallTab = DDS.isSmallTab;
DDS.setNewValues();
DDS.checkSmallTab(o);
if (smallTab === DDS.isSmallTab) {
@@ -102,7 +102,7 @@ const App = () => {
setTimeout(() => {
resetApp();
- }, 1000);
+ }, 1000); */
};
const syncChanges = async () => {
dispatch({type: Actions.ALL});
@@ -110,12 +110,12 @@ const App = () => {
resetApp = async () => {
note = getNote();
setInit(false);
- Initialize();
+ await SettingsService.init();
setInit(true);
await sleep(300);
if (note && note.id) {
eSendEvent(eOnLoadNote, note);
- if (DDS.isPhone || DDS.isSmallTab) {
+ if (!DDS.isLargeTablet()) {
tabBarRef.current?.goToPage(1);
}
note = null;
@@ -175,7 +175,7 @@ const App = () => {
};
useEffect(() => {
- Initialize();
+ SettingsService.init().then((r) => r);
let error = null;
(async () => {
try {
@@ -214,19 +214,6 @@ const App = () => {
}
}
- function Initialize() {
- Orientation.lockToLandscape();
- if (firstLoad) {
- console.log(DDS.isTab);
- if (DDS.isTab) {
- } else {
- Orientation.lockToPortrait();
- }
- firstLoad = false;
- }
- SettingsService.init().then((r) => r);
- }
-
return (
<>
<SafeAreaProvider>
diff --git a/apps/mobile/src/services/DeviceDetection.js b/apps/mobile/src/services/DeviceDetection.js
index 1d2bc1bd2..df7712997 100644
--- a/apps/mobile/src/services/DeviceDetection.js
+++ b/apps/mobile/src/services/DeviceDetection.js
@@ -5,7 +5,7 @@ let windowSize = Dimensions.get('window');
export class DeviceDetectionService {
constructor() {
- this.setNewValues();
+ this.setNewValues();
}
setNewValues() {
@@ -46,14 +46,17 @@ export class DeviceDetectionService {
this.width = Dimensions.get('screen').width;
this.height = Dimensions.get('screen').height;
let deviceSize = this.getDeviceSize();
- console.log(orientation,"orientation")
- if (DeviceInfo.isTablet() && (orientation === "PORTRAIT" || deviceSize < 9)) {
+ console.log(orientation, 'orientation');
+ if (
+ (!DeviceInfo.isTablet() && orientation === 'LANDSCAPE') ||
+ (DeviceInfo.isTablet() && (orientation === 'PORTRAIT' || deviceSize < 9))
+ ) {
console.log('small tab');
this.isTab = true;
this.isPhone = false;
this.isSmallTab = true;
} else {
- if (!DeviceInfo.isTablet() ) {
+ if (!DeviceInfo.isTablet()) {
this.isTab = false;
this.isPhone = true;
this.isSmallTab = false;
@@ -62,7 +65,6 @@ export class DeviceDetectionService {
this.isSmallTab = false;
this.isPhone = true;
}
-
}
}
@@ -107,15 +109,16 @@ export class DeviceDetectionService {
}
detectIphoneX() {
- this.isIphoneX = Platform.OS === 'ios' &&
- !Platform.isTVOS &&
- !Platform.isTVOS &&
- (windowSize.height === 812 || windowSize.width === 812);
+ this.isIphoneX =
+ Platform.OS === 'ios' &&
+ !Platform.isTVOS &&
+ !Platform.isTVOS &&
+ (windowSize.height === 812 || windowSize.width === 812);
}
- isLargeTablet() {
- return this.isTab && !this.isSmallTab
+ isLargeTablet() {
+ return this.isTab && !this.isSmallTab;
}
}
-export const DDS = new DeviceDetectionService();
\ No newline at end of file
+export const DDS = new DeviceDetectionService();