diff --git a/apps/mobile/app/app.tsx b/apps/mobile/app/app.tsx
index 9a6586fe0..091d618c7 100644
--- a/apps/mobile/app/app.tsx
+++ b/apps/mobile/app/app.tsx
@@ -19,20 +19,22 @@ along with this program. If not, see .
import { i18n } from "@lingui/core";
import { I18nProvider } from "@lingui/react";
import {
+ ScopedThemeProvider,
THEME_COMPATIBILITY_VERSION,
useThemeEngineStore
} from "@notesnook/theme";
import React, { useEffect } from "react";
-import { I18nManager, View } from "react-native";
+import { I18nManager, StatusBar } from "react-native";
import "react-native-gesture-handler";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { SafeAreaProvider } from "react-native-safe-area-context";
-import AppLockedOverlay from "./components/app-lock-overlay";
+import DialogProvider from "./components/dialog-provider";
import { withErrorBoundry } from "./components/exception-handler";
import GlobalSafeAreaProvider from "./components/globalsafearea";
+import { Toast } from "./components/toast";
import { useAppEvents } from "./hooks/use-app-events";
-import { ApplicationHolder } from "./navigation";
import { NotePreviewConfigure } from "./screens/note-preview-configure";
+import { RootNavigation } from "./navigation/navigation-stack";
import { themeTrpcClient } from "./screens/settings/theme-selector";
import Notifications from "./services/notifications";
import SettingsService from "./services/settings";
@@ -64,42 +66,26 @@ const App = (props: { configureMode: "note-preview" }) => {
}, []);
return (
-
-
-
-
-
-
-
+
+
+
{props.configureMode === "note-preview" ? (
) : (
-
+
)}
+
+
+
+
-
-
+
);
};
diff --git a/apps/mobile/app/components/app-lock-overlay/index.tsx b/apps/mobile/app/components/app-lock-overlay/index.tsx
index 9f13e012e..f376778b5 100644
--- a/apps/mobile/app/components/app-lock-overlay/index.tsx
+++ b/apps/mobile/app/components/app-lock-overlay/index.tsx
@@ -82,7 +82,7 @@ const verifyUserPassword = async (password: string) => {
}
};
-const AppLockedOverlay = () => {
+const AppLockedScreen = () => {
const initialLaunchBiometricRequest = useRef(true);
const { colors } = useThemeColors();
const user = getUser();
@@ -203,14 +203,12 @@ const AppLockedOverlay = () => {
}
}, [appState, onUnlockAppRequested, appLocked]);
- return appLocked ? (
+ return (
{
- ) : null;
+ );
};
-export default AppLockedOverlay;
+export default AppLockedScreen;
diff --git a/apps/mobile/app/components/container/floating-button.tsx b/apps/mobile/app/components/container/floating-button.tsx
index 22146e3e7..6cb76f7b1 100644
--- a/apps/mobile/app/components/container/floating-button.tsx
+++ b/apps/mobile/app/components/container/floating-button.tsx
@@ -20,7 +20,7 @@ along with this program. If not, see .
import { useThemeColors } from "@notesnook/theme";
import { useRoute } from "@react-navigation/native";
import React, { useCallback, useEffect } from "react";
-import { Keyboard, View } from "react-native";
+import { Keyboard, TouchableOpacity, View } from "react-native";
import Animated, {
Easing,
useAnimatedStyle,
@@ -34,7 +34,7 @@ import { useSelectionStore } from "../../stores/use-selection-store";
import { useSettingStore } from "../../stores/use-setting-store";
import { getElevationStyle } from "../../utils/elevation";
import { SIZE, normalize } from "../../utils/size";
-import { Pressable } from "../ui/pressable";
+import { DefaultAppStyles } from "../../utils/styles";
interface FloatingButtonProps {
onPress: () => void;
@@ -108,20 +108,24 @@ const FloatingButton = ({
style={[
{
position: "absolute",
- right: 12,
+ right: DefaultAppStyles.GAP,
bottom: 20,
zIndex: 10
},
animatedStyle
]}
>
-
@@ -130,7 +134,9 @@ const FloatingButton = ({
alignItems: "center",
justifyContent: "center",
height: normalize(60),
- width: normalize(60)
+ width: normalize(60),
+ backgroundColor: colors.primary.shade,
+ borderRadius: 20
}}
>
-
+
);
};
diff --git a/apps/mobile/app/components/dialog/dialog-buttons.js b/apps/mobile/app/components/dialog/dialog-buttons.js
index ca1410f4c..f4a3d8f23 100644
--- a/apps/mobile/app/components/dialog/dialog-buttons.js
+++ b/apps/mobile/app/components/dialog/dialog-buttons.js
@@ -46,8 +46,6 @@ const DialogButtons = ({
{
backgroundColor: colors.secondary.background,
height: 60,
- borderBottomRightRadius: 5,
- borderBottomLeftRadius: 5,
paddingHorizontal: 12,
borderTopWidth: 0.7,
borderTopColor: getColorLinearShade(
diff --git a/apps/mobile/app/components/dialog/index.js b/apps/mobile/app/components/dialog/index.js
index 1549f93d6..04b035f84 100644
--- a/apps/mobile/app/components/dialog/index.js
+++ b/apps/mobile/app/components/dialog/index.js
@@ -39,6 +39,7 @@ import { Button } from "../ui/button";
import { getContainerBorder } from "../../utils/colors";
import { Notice } from "../ui/notice";
import { strings } from "@notesnook/intl";
+import { br } from "../../utils/size";
export const Dialog = ({ context = "global" }) => {
const { colors } = useThemeColors();
@@ -125,10 +126,11 @@ export const Dialog = ({ context = "global" }) => {
...getElevationStyle(5),
width: DDS.isTab ? 400 : "85%",
maxHeight: 450,
- borderRadius: 5,
+ borderRadius: br,
backgroundColor: colors.primary.background,
paddingTop: 12,
- ...getContainerBorder(colors.primary.border, 0.5)
+ ...getContainerBorder(colors.primary.border, 0.5),
+ overflow: "hidden"
};
return visible ? (
diff --git a/apps/mobile/app/components/dialogs/vault/index.js b/apps/mobile/app/components/dialogs/vault/index.js
index e2d0214d4..c192cc7a4 100644
--- a/apps/mobile/app/components/dialogs/vault/index.js
+++ b/apps/mobile/app/components/dialogs/vault/index.js
@@ -41,7 +41,7 @@ import {
eUpdateNoteInEditor
} from "../../../utils/events";
import { deleteItems } from "../../../utils/functions";
-import { tabBarRef } from "../../../utils/global-refs";
+import { fluidTabsRef } from "../../../utils/global-refs";
import { convertNoteToText } from "../../../utils/note-to-text";
import { sleep } from "../../../utils/time";
import BaseDialog from "../../dialog/base-dialog";
@@ -553,7 +553,7 @@ export class VaultDialog extends Component {
item: note
});
if (!DDS.isTab) {
- tabBarRef.current?.goToPage(1);
+ fluidTabsRef.current?.goToPage(1);
}
});
}
diff --git a/apps/mobile/app/components/tabs/index.tsx b/apps/mobile/app/components/fluid-panels/index.tsx
similarity index 93%
rename from apps/mobile/app/components/tabs/index.tsx
rename to apps/mobile/app/components/fluid-panels/index.tsx
index 11d58c90b..e4c8298e1 100644
--- a/apps/mobile/app/components/tabs/index.tsx
+++ b/apps/mobile/app/components/fluid-panels/index.tsx
@@ -37,12 +37,12 @@ import Animated, {
WithSpringConfig,
withTiming
} from "react-native-reanimated";
+import { useTabStore } from "../../screens/editor/tiptap/use-tab-store";
import { getAppState } from "../../screens/editor/tiptap/utils";
import { eSendEvent } from "../../services/event-manager";
import { useSettingStore } from "../../stores/use-setting-store";
import { eClearEditor } from "../../utils/events";
import { useSideBarDraggingStore } from "../side-menu/dragging-store";
-import { useTabStore } from "../../screens/editor/tiptap/use-tab-store";
interface TabProps extends ViewProps {
dimensions: { width: number; height: number };
@@ -66,7 +66,7 @@ export interface TabsRef {
node: RefObject;
}
-export const FluidTabs = forwardRef(function FluidTabs(
+export const FluidPanels = forwardRef(function FluidTabs(
{
children,
dimensions,
@@ -81,9 +81,6 @@ export const FluidTabs = forwardRef(function FluidTabs(
const appState = useMemo(() => getAppState(), []);
const deviceMode = useSettingStore((state) => state.deviceMode);
const fullscreen = useSettingStore((state) => state.fullscreen);
- const introCompleted = useSettingStore(
- (state) => state.settings.introCompleted
- );
const translateX = useSharedValue(
widths
? appState &&
@@ -118,26 +115,34 @@ export const FluidTabs = forwardRef(function FluidTabs(
const isIPhone = Platform.OS === "ios";
useEffect(() => {
- if (introCompleted) {
- if (deviceMode === "tablet" || fullscreen) {
- translateX.value = 0;
- } else {
- if (prevWidths.current?.sidebar !== widths.sidebar) {
- translateX.value =
- appState && appState?.movedAway === false
- ? editorPosition
- : widths.sidebar;
- if (translateX.value === editorPosition) {
- onChangeTab?.({ i: 2, from: 1 });
- }
+ if (deviceMode === "tablet" || fullscreen) {
+ translateX.value = 0;
+ } else {
+ if (prevWidths.current?.sidebar !== widths.sidebar) {
+ translateX.value =
+ appState && appState?.movedAway === false
+ ? editorPosition
+ : widths.sidebar;
+ if (translateX.value === editorPosition) {
+ onChangeTab?.({ i: 2, from: 1 });
}
}
- isLoaded.current = true;
- prevWidths.current = widths;
}
+ isLoaded.current = true;
+ prevWidths.current = widths;
+ }, [
+ deviceMode,
+ widths,
+ fullscreen,
+ translateX,
+ editorPosition,
+ appState,
+ onChangeTab
+ ]);
+ useEffect(() => {
const sub = BackHandler.addEventListener("hardwareBackPress", () => {
- if (isDrawerOpen.value) {
+ if (isDrawerOpen.value && !forcedLock.value) {
translateX.value = withTiming(homePosition);
onDrawerStateChange(false);
isDrawerOpen.value = false;
@@ -149,16 +154,11 @@ export const FluidTabs = forwardRef(function FluidTabs(
sub && sub.remove();
};
}, [
- introCompleted,
- deviceMode,
- widths,
- fullscreen,
- translateX,
- isDrawerOpen,
+ forcedLock.value,
homePosition,
+ isDrawerOpen,
onDrawerStateChange,
- editorPosition,
- appState
+ translateX
]);
useImperativeHandle(
@@ -294,8 +294,8 @@ export const FluidTabs = forwardRef(function FluidTabs(
const gesture = Gesture.Pan()
.maxPointers(1)
.enabled(enabled && !disabled)
- .activeOffsetX([-5, 5])
- .failOffsetY([-15, 15])
+ .activeOffsetX([-20, 20])
+ .failOffsetY([-10, 10])
.onBegin((event) => {
locked.value = false;
gestureStartValue.value = {
diff --git a/apps/mobile/app/components/header/index.tsx b/apps/mobile/app/components/header/index.tsx
index 2f94db30a..c55443ea3 100644
--- a/apps/mobile/app/components/header/index.tsx
+++ b/apps/mobile/app/components/header/index.tsx
@@ -17,60 +17,52 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
+import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React, { useCallback, useEffect, useState } from "react";
-import { Platform, StyleSheet, View } from "react-native";
-import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
+import { View } from "react-native";
import {
eSubscribeEvent,
eUnSubscribeEvent
} from "../../services/event-manager";
-import useNavigationStore, {
- RouteName
-} from "../../stores/use-navigation-store";
+import { RouteName } from "../../stores/use-navigation-store";
import { useSelectionStore } from "../../stores/use-selection-store";
import { eScrollEvent } from "../../utils/events";
+import { SIZE } from "../../utils/size";
+import { DefaultAppStyles } from "../../utils/styles";
+import { IconButtonProps } from "../ui/icon-button";
+import { Pressable } from "../ui/pressable";
+import Heading from "../ui/typography/heading";
+import Paragraph from "../ui/typography/paragraph";
import { LeftMenus } from "./left-menus";
import { RightMenus } from "./right-menus";
-import { Title } from "./title";
-
-type HeaderRightButton = {
- title: string;
- onPress: () => void;
-};
export const Header = ({
renderedInRoute,
onLeftMenuButtonPress,
title,
- titleHiddenOnRender,
- headerRightButtons,
id,
- accentColor,
- isBeta,
canGoBack,
- onPressDefaultRightButton,
hasSearch,
- onSearch
+ onSearch,
+ rightButton
}: {
onLeftMenuButtonPress?: () => void;
renderedInRoute?: RouteName;
id?: string;
title: string;
- headerRightButtons?: HeaderRightButton[];
- titleHiddenOnRender?: boolean;
- accentColor?: string;
- isBeta?: boolean;
canGoBack?: boolean;
onPressDefaultRightButton?: () => void;
hasSearch?: boolean;
onSearch?: () => void;
+ rightButton?: IconButtonProps;
}) => {
const { colors } = useThemeColors();
- const insets = useGlobalSafeAreaInsets();
const [borderHidden, setBorderHidden] = useState(true);
- const selectionMode = useSelectionStore((state) => state.selectionMode);
- const isFocused = useNavigationStore((state) => state.focusedRouteId === id);
+ const [selectedItemsList, selectionMode] = useSelectionStore((state) => [
+ state.selectedItemsList,
+ state.selectionMode
+ ]);
const onScroll = useCallback(
(data: { x: number; y: number; id?: string; route: string }) => {
@@ -93,88 +85,47 @@ export const Header = ({
};
}, [borderHidden, onScroll]);
- return selectionMode && isFocused ? null : (
- <>
-
- <>
-
-
+ const HeaderWrapper = hasSearch ? Pressable : View;
-
-
-
- >
-
- >
+ return (
+
+ {
+ onSearch?.();
+ }}
+ >
+
+
+ {hasSearch ? (
+
+ {selectionMode
+ ? `${selectedItemsList.length} selected`
+ : strings.searchInRoute(title)}
+
+ ) : (
+ {title}
+ )}
+
+
+
+
);
};
-
-const styles = StyleSheet.create({
- container: {
- flexDirection: "row",
- zIndex: 11,
- height: 50,
- maxHeight: 50,
- justifyContent: "center",
- alignItems: "center",
- paddingHorizontal: 12,
- width: "100%"
- },
- leftBtnContainer: {
- flexDirection: "row",
- justifyContent: "flex-start",
- alignItems: "center",
- flexShrink: 1
- },
- leftBtn: {
- justifyContent: "center",
- alignItems: "center",
- height: 40,
- width: 40,
- borderRadius: 100,
- marginLeft: -5,
- marginRight: 25
- },
- rightBtnContainer: {
- flexDirection: "row",
- alignItems: "center"
- },
- rightBtn: {
- justifyContent: "center",
- alignItems: "flex-end",
- height: 40,
- width: 40,
- paddingRight: 0
- }
-});
diff --git a/apps/mobile/app/components/header/left-menus.tsx b/apps/mobile/app/components/header/left-menus.tsx
index e6aa0fcaf..c95530cfe 100644
--- a/apps/mobile/app/components/header/left-menus.tsx
+++ b/apps/mobile/app/components/header/left-menus.tsx
@@ -20,10 +20,9 @@ along with this program. If not, see .
import { useThemeColors } from "@notesnook/theme";
import React from "react";
import { notesnook } from "../../../e2e/test.ids";
-import { DDS } from "../../services/device-detection";
import Navigation from "../../services/navigation";
import { useSettingStore } from "../../stores/use-setting-store";
-import { tabBarRef } from "../../utils/global-refs";
+import { fluidTabsRef } from "../../utils/global-refs";
import { IconButton } from "../ui/icon-button";
export const LeftMenus = ({
@@ -41,7 +40,7 @@ export const LeftMenus = ({
if (onLeftButtonPress) return onLeftButtonPress();
if (!canGoBack) {
- if (tabBarRef.current?.isDrawerOpen()) {
+ if (fluidTabsRef.current?.isDrawerOpen()) {
Navigation.closeDrawer();
} else {
Navigation.openDrawer();
@@ -54,23 +53,14 @@ export const LeftMenus = ({
return isTablet && !canGoBack ? null : (
{
Navigation.popToTop();
}}
name={canGoBack ? "arrow-left" : "menu"}
- color={colors.primary.paragraph}
+ color={colors.primary.icon}
/>
);
};
diff --git a/apps/mobile/app/components/header/right-menus.tsx b/apps/mobile/app/components/header/right-menus.tsx
index 8f4ec9f0b..fe44ed5ca 100644
--- a/apps/mobile/app/components/header/right-menus.tsx
+++ b/apps/mobile/app/components/header/right-menus.tsx
@@ -17,127 +17,30 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-import React, { useRef } from "react";
-import { Platform, StyleSheet, View } from "react-native";
import { useThemeColors } from "@notesnook/theme";
-import { Menu } from "react-native-material-menu";
-import { notesnook } from "../../../e2e/test.ids";
-import {
- HeaderRightButton,
- RouteName
-} from "../../stores/use-navigation-store";
-import { useSettingStore } from "../../stores/use-setting-store";
-import { SIZE } from "../../utils/size";
-import { sleep } from "../../utils/time";
-import { Button } from "../ui/button";
-import { IconButton } from "../ui/icon-button";
+import React from "react";
+import { StyleSheet, View } from "react-native";
+import { IconButton, IconButtonProps } from "../ui/icon-button";
export const RightMenus = ({
- headerRightButtons,
- renderedInRoute,
- id,
- onPressDefaultRightButton,
- search,
- onSearch
+ rightButton
}: {
- headerRightButtons?: HeaderRightButton[];
- renderedInRoute?: RouteName;
- id?: string;
- onPressDefaultRightButton?: () => void;
- search?: boolean;
- onSearch?: () => void;
+ rightButton?: IconButtonProps;
}) => {
const { colors } = useThemeColors();
- const { colors: contextMenuColors } = useThemeColors("contextMenu");
- const deviceMode = useSettingStore((state) => state.deviceMode);
- const menuRef = useRef