mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
minor fixes in ui for tabs
This commit is contained in:
@@ -10,6 +10,8 @@ import SideMenu from './src/components/SideMenu';
|
|||||||
import {Toast} from './src/components/Toast';
|
import {Toast} from './src/components/Toast';
|
||||||
import {useTracked} from './src/provider';
|
import {useTracked} from './src/provider';
|
||||||
import {ACTIONS} from './src/provider/actions';
|
import {ACTIONS} from './src/provider/actions';
|
||||||
|
import Orientation from 'react-native-orientation';
|
||||||
|
|
||||||
import {eSubscribeEvent, eUnSubscribeEvent} from './src/services/eventManager';
|
import {eSubscribeEvent, eUnSubscribeEvent} from './src/services/eventManager';
|
||||||
import {
|
import {
|
||||||
eCloseFullscreenEditor,
|
eCloseFullscreenEditor,
|
||||||
@@ -28,6 +30,7 @@ import StorageInterface from './src/utils/storage';
|
|||||||
import {w} from './src/utils/utils';
|
import {w} from './src/utils/utils';
|
||||||
import Editor from './src/views/Editor';
|
import Editor from './src/views/Editor';
|
||||||
import Animated, {Easing} from 'react-native-reanimated';
|
import Animated, {Easing} from 'react-native-reanimated';
|
||||||
|
import {useForceUpdate} from './src/views/ListsEditor';
|
||||||
|
|
||||||
export const DDS = new DeviceDetectionService();
|
export const DDS = new DeviceDetectionService();
|
||||||
export const db = new Storage(StorageInterface);
|
export const db = new Storage(StorageInterface);
|
||||||
@@ -41,7 +44,7 @@ const {color, Value, timing, interpolate} = Animated;
|
|||||||
const App = () => {
|
const App = () => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors, loading} = state;
|
const {colors, loading} = state;
|
||||||
|
const forceUpdate = useForceUpdate();
|
||||||
const [init, setInit] = useState(false);
|
const [init, setInit] = useState(false);
|
||||||
const [fullscreen, setFullscreen] = useState(false);
|
const [fullscreen, setFullscreen] = useState(false);
|
||||||
|
|
||||||
@@ -91,7 +94,16 @@ const App = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _onOrientationChange = o => {
|
||||||
|
// Currently orientation is locked on tablet.
|
||||||
|
/* DDS.checkOrientation();
|
||||||
|
setTimeout(() => {
|
||||||
|
alert('here');
|
||||||
|
forceUpdate();
|
||||||
|
}, 1000); */
|
||||||
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Orientation.addOrientationListener(_onOrientationChange);
|
||||||
eSubscribeEvent(eDispatchAction, type => {
|
eSubscribeEvent(eDispatchAction, type => {
|
||||||
dispatch(type);
|
dispatch(type);
|
||||||
});
|
});
|
||||||
@@ -99,10 +111,12 @@ const App = () => {
|
|||||||
eUnSubscribeEvent(eDispatchAction, type => {
|
eUnSubscribeEvent(eDispatchAction, type => {
|
||||||
dispatch(type);
|
dispatch(type);
|
||||||
});
|
});
|
||||||
|
Orientation.removeOrientationListener(_onOrientationChange);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Orientation.lockToLandscape();
|
||||||
eSubscribeEvent(eOpenSideMenu, openSidebar);
|
eSubscribeEvent(eOpenSideMenu, openSidebar);
|
||||||
eSubscribeEvent(eCloseSideMenu, closeSidebar);
|
eSubscribeEvent(eCloseSideMenu, closeSidebar);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#import <React/RCTBridge.h>
|
#import <React/RCTBridge.h>
|
||||||
#import <React/RCTBundleURLProvider.h>
|
#import <React/RCTBundleURLProvider.h>
|
||||||
#import <React/RCTRootView.h>
|
#import <React/RCTRootView.h>
|
||||||
|
#import "Orientation.h"
|
||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
|
||||||
@@ -39,4 +40,9 @@
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
|
||||||
|
return [Orientation getOrientation];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -188,6 +188,8 @@ PODS:
|
|||||||
- react-native-fast-storage (0.1.4):
|
- react-native-fast-storage (0.1.4):
|
||||||
- MMKV (= 1.0.23)
|
- MMKV (= 1.0.23)
|
||||||
- React
|
- React
|
||||||
|
- react-native-orientation (3.1.3):
|
||||||
|
- React
|
||||||
- react-native-webview (7.5.1):
|
- react-native-webview (7.5.1):
|
||||||
- React
|
- React
|
||||||
- React-RCTActionSheet (0.61.5):
|
- React-RCTActionSheet (0.61.5):
|
||||||
@@ -258,6 +260,7 @@ DEPENDENCIES:
|
|||||||
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
|
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
|
||||||
- react-native-aes (from `../node_modules/react-native-aes-crypto`)
|
- react-native-aes (from `../node_modules/react-native-aes-crypto`)
|
||||||
- react-native-fast-storage (from `../node_modules/react-native-fast-storage`)
|
- react-native-fast-storage (from `../node_modules/react-native-fast-storage`)
|
||||||
|
- react-native-orientation (from `../node_modules/react-native-orientation`)
|
||||||
- react-native-webview (from `../node_modules/react-native-webview`)
|
- react-native-webview (from `../node_modules/react-native-webview`)
|
||||||
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
||||||
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
|
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
|
||||||
@@ -316,6 +319,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: "../node_modules/react-native-aes-crypto"
|
:path: "../node_modules/react-native-aes-crypto"
|
||||||
react-native-fast-storage:
|
react-native-fast-storage:
|
||||||
:path: "../node_modules/react-native-fast-storage"
|
:path: "../node_modules/react-native-fast-storage"
|
||||||
|
react-native-orientation:
|
||||||
|
:path: "../node_modules/react-native-orientation"
|
||||||
react-native-webview:
|
react-native-webview:
|
||||||
:path: "../node_modules/react-native-webview"
|
:path: "../node_modules/react-native-webview"
|
||||||
React-RCTActionSheet:
|
React-RCTActionSheet:
|
||||||
@@ -372,6 +377,7 @@ SPEC CHECKSUMS:
|
|||||||
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
|
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
|
||||||
react-native-aes: 22ea989d641f53ea7722fe6b146349ed66e6455d
|
react-native-aes: 22ea989d641f53ea7722fe6b146349ed66e6455d
|
||||||
react-native-fast-storage: bc274e68f7d87ffe777a1d20479544b7cd429b1d
|
react-native-fast-storage: bc274e68f7d87ffe777a1d20479544b7cd429b1d
|
||||||
|
react-native-orientation: f1caf84d65f1a4fd4511a18f2b924e634ad7a628
|
||||||
react-native-webview: 2aadbfef6b9eaa9e89b306ae3e31e6e870a6306d
|
react-native-webview: 2aadbfef6b9eaa9e89b306ae3e31e6e870a6306d
|
||||||
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
|
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
|
||||||
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
|
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export const ActionSheetComponent = ({
|
|||||||
|
|
||||||
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
||||||
let newColors = setColorScheme(colors, accent);
|
let newColors = setColorScheme(colors, accent);
|
||||||
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
|
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
|
||||||
|
|
||||||
dispatch({type: ACTIONS.THEME, colors: newColors});
|
dispatch({type: ACTIONS.THEME, colors: newColors});
|
||||||
}
|
}
|
||||||
@@ -180,8 +180,8 @@ export const ActionSheetComponent = ({
|
|||||||
func: () => {
|
func: () => {
|
||||||
dispatch({type: ACTIONS.MODAL_NAVIGATOR, enabled: true});
|
dispatch({type: ACTIONS.MODAL_NAVIGATOR, enabled: true});
|
||||||
dispatch({type: ACTIONS.SELECTED_ITEMS, item: note});
|
dispatch({type: ACTIONS.SELECTED_ITEMS, item: note});
|
||||||
moveNoteEvent();
|
|
||||||
close();
|
close('movenote');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -375,6 +375,10 @@ export class DialogManager extends Component {
|
|||||||
this.showAddTOpic();
|
this.showAddTOpic();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'movenote': {
|
||||||
|
moveNoteEvent();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.show = null;
|
this.show = null;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export const Menu = ({
|
|||||||
|
|
||||||
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
||||||
let newColors = setColorScheme(colors, accent);
|
let newColors = setColorScheme(colors, accent);
|
||||||
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
|
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
|
||||||
|
|
||||||
dispatch({type: ACTIONS.THEME, colors: newColors});
|
dispatch({type: ACTIONS.THEME, colors: newColors});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ class MoveNoteDialog extends React.Component {
|
|||||||
...getElevation(DDS.isTab ? 10 : 0),
|
...getElevation(DDS.isTab ? 10 : 0),
|
||||||
width: DDS.isTab ? '65%' : '100%',
|
width: DDS.isTab ? '65%' : '100%',
|
||||||
height: DDS.isTab ? '90%' : '100%',
|
height: DDS.isTab ? '90%' : '100%',
|
||||||
|
flex: 1,
|
||||||
borderRadius: DDS.isTab ? 5 : 0,
|
borderRadius: DDS.isTab ? 5 : 0,
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
padding: DDS.isTab ? 8 : 0,
|
padding: DDS.isTab ? 8 : 0,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {Dimensions, PixelRatio, Platform} from 'react-native';
|
import {Dimensions, PixelRatio, Platform} from 'react-native';
|
||||||
|
|
||||||
const windowSize = Dimensions.get('window');
|
const windowSize = Dimensions.get('window');
|
||||||
|
|
||||||
export class DeviceDetectionService {
|
export class DeviceDetectionService {
|
||||||
@@ -12,6 +13,19 @@ export class DeviceDetectionService {
|
|||||||
this.isPhoneOrTablet();
|
this.isPhoneOrTablet();
|
||||||
this.isIosOrAndroid();
|
this.isIosOrAndroid();
|
||||||
this.detectIphoneX();
|
this.detectIphoneX();
|
||||||
|
this.checkOrientation();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkOrientation() {
|
||||||
|
this.width = Dimensions.get('window').width;
|
||||||
|
this.height = Dimensions.get('window').height;
|
||||||
|
if (this.width < this.height) {
|
||||||
|
this.isTab = false;
|
||||||
|
this.isPhone = true;
|
||||||
|
} else {
|
||||||
|
this.isTab = true;
|
||||||
|
this.isPhone = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isPhoneOrTablet() {
|
isPhoneOrTablet() {
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ const Editor = ({navigation, noMenu}) => {
|
|||||||
id: id,
|
id: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (id !== rId && note && !note.locked) {
|
if (id !== rId && !note?.locked) {
|
||||||
id = rId;
|
id = rId;
|
||||||
note = db.notes.note(id);
|
note = db.notes.note(id);
|
||||||
if (note) {
|
if (note) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const Settings = ({navigation}) => {
|
|||||||
|
|
||||||
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
||||||
let newColors = setColorScheme(colors, accent);
|
let newColors = setColorScheme(colors, accent);
|
||||||
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
|
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
|
||||||
|
|
||||||
dispatch({type: ACTIONS.THEME, colors: newColors});
|
dispatch({type: ACTIONS.THEME, colors: newColors});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user