Skip to content

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

mobile: fix tsc errors

Ammar Ahmedc9a9b8dffb92
diff --git a/apps/mobile/app/components/attachments/index.tsx b/apps/mobile/app/components/attachments/index.tsx
index 7424d6c46..5bb4da5e2 100644
--- a/apps/mobile/app/components/attachments/index.tsx
+++ b/apps/mobile/app/components/attachments/index.tsx
@@ -325,30 +325,31 @@ export const AttachmentDialog = ({
title={strings.manageAttachments()}
renderedInRoute="SettingsGroup"
canGoBack
- headerRightButtons={[
- {
- onPress() {
- onCheck();
- },
- title: strings.recheckAll()
- },
- {
- onPress() {
- if (!attachments) return;
- presentDialog({
- title: strings.doActions.download.attachment(
- attachments.placeholders.length
- ),
- positiveText: strings.network.download(),
- positivePress: async () => {
- downloadAttachments(await attachments.ids());
- },
- negativeText: strings.cancel()
- });
- },
- title: strings.downloadAllAttachments()
- }
- ]}
+ // TODO: Add headerRightButtons
+ // headerRightButtons={[
+ // {
+ // onPress() {
+ // onCheck();
+ // },
+ // title: strings.recheckAll()
+ // },
+ // {
+ // onPress() {
+ // if (!attachments) return;
+ // presentDialog({
+ // title: strings.doActions.download.attachment(
+ // attachments.placeholders.length
+ // ),
+ // positiveText: strings.network.download(),
+ // positivePress: async () => {
+ // downloadAttachments(await attachments.ids());
+ // },
+ // negativeText: strings.cancel()
+ // });
+ // },
+ // title: strings.downloadAllAttachments()
+ // }
+ // ]}
/>
) : (
<View
diff --git a/apps/mobile/app/components/list-items/headers/header.tsx b/apps/mobile/app/components/list-items/headers/header.tsx
index ebe6f974c..a90fe430c 100644
--- a/apps/mobile/app/components/list-items/headers/header.tsx
+++ b/apps/mobile/app/components/list-items/headers/header.tsx
@@ -24,12 +24,13 @@ import { useMessageStore } from "../../../stores/use-message-store";
import { useSelectionStore } from "../../../stores/use-selection-store";
import { Announcement } from "../../announcements/announcement";
import { Card } from "../../list/card";
+import { RouteParams } from "../../../stores/use-navigation-store";
export type ListHeaderProps = {
noAnnouncement?: boolean;
color?: string;
messageCard?: boolean;
- screen?: string;
+ screen?: keyof RouteParams;
shouldShow?: boolean;
};
diff --git a/apps/mobile/app/components/list-items/reminder/index.tsx b/apps/mobile/app/components/list-items/reminder/index.tsx
index 2f835d787..d24ed73f4 100644
--- a/apps/mobile/app/components/list-items/reminder/index.tsx
+++ b/apps/mobile/app/components/list-items/reminder/index.tsx
@@ -161,7 +161,7 @@ const ReminderItem = React.memo(
color={colors.primary.paragraph}
name="dots-horizontal"
size={SIZE.xl}
- onPress={() => Properties.present(item, [], isSheet)}
+ onPress={() => Properties.present(item, isSheet)}
style={{
justifyContent: "center",
height: 35,
diff --git a/apps/mobile/app/components/list/empty.tsx b/apps/mobile/app/components/list/empty.tsx
index 726fe29bc..3632ac206 100644
--- a/apps/mobile/app/components/list/empty.tsx
+++ b/apps/mobile/app/components/list/empty.tsx
@@ -30,6 +30,7 @@ import { Button } from "../ui/button";
import Seperator from "../ui/seperator";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
+import { RouteParams } from "../../stores/use-navigation-store";
export type PlaceholderData = {
title: string;
@@ -46,7 +47,7 @@ type EmptyListProps = {
title?: string;
color?: string;
dataType: string;
- screen?: string;
+ screen?: keyof RouteParams;
};
export const Empty = React.memo(function Empty({
diff --git a/apps/mobile/app/components/side-menu/index.tsx b/apps/mobile/app/components/side-menu/index.tsx
index 37a259d83..f23d67462 100644
--- a/apps/mobile/app/components/side-menu/index.tsx
+++ b/apps/mobile/app/components/side-menu/index.tsx
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { useThemeColors } from "@notesnook/theme";
import React from "react";
import { Image, View } from "react-native";
+import { SafeAreaView } from "react-native-safe-area-context";
import {
NavigationState,
Route,
@@ -33,10 +34,10 @@ import { db } from "../../common/database";
import Navigation from "../../services/navigation";
import { useUserStore } from "../../stores/use-user-store";
import { deleteItems } from "../../utils/functions";
+import { rootNavigatorRef } from "../../utils/global-refs";
import { SIZE } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
import { MoveNotebookSheet } from "../sheets/move-notebook";
-import { UserSheet } from "../sheets/user";
import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph";
import { SideMenuHome } from "./side-menu-home";
@@ -46,8 +47,6 @@ import {
useSideMenuNotebookSelectionStore,
useSideMenuTagsSelectionStore
} from "./stores";
-import { SafeAreaView } from "react-native-safe-area-context";
-import { rootNavigatorRef } from "../../utils/global-refs";
const renderScene = SceneMap({
home: SideMenuHome,
notebooks: SideMenuNotebooks,
@@ -248,12 +247,12 @@ const TabBar = (
const ids = useSideMenuNotebookSelectionStore
.getState()
.getSelectedItemIds();
- deleteItems(ids, "notebook");
+ deleteItems("notebook", ids);
} else {
const ids = useSideMenuTagsSelectionStore
.getState()
.getSelectedItemIds();
- deleteItems(ids, "tag");
+ deleteItems("tag", ids);
}
break;
}
diff --git a/apps/mobile/app/components/walkthroughs/walkthroughs.tsx b/apps/mobile/app/components/walkthroughs/walkthroughs.tsx
index f2ed48f19..ce327f377 100644
--- a/apps/mobile/app/components/walkthroughs/walkthroughs.tsx
+++ b/apps/mobile/app/components/walkthroughs/walkthroughs.tsx
@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import { Notebook } from "@notesnook/core";
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React from "react";
@@ -35,7 +34,6 @@ import { getContainerBorder } from "../../utils/colors";
import { getElevationStyle } from "../../utils/elevation";
import { eOpenAddNotebookDialog } from "../../utils/events";
import { SIZE } from "../../utils/size";
-import { PinItem } from "../side-menu/pinned-section";
import { Button } from "../ui/button";
import Seperator from "../ui/seperator";
import { SvgView } from "../ui/svg";
@@ -254,7 +252,7 @@ const notebooks: { id: string; steps: TStep[] } = {
paddingVertical: 12
}}
>
- <PinItem
+ {/* <PinItem
isPlaceholder={true}
item={
{
@@ -274,7 +272,7 @@ const notebooks: { id: string; steps: TStep[] } = {
} as Notebook
}
onPress={() => {}}
- />
+ /> */}
</View>
),
button: {
diff --git a/apps/mobile/app/hooks/use-tooltip.ts b/apps/mobile/app/hooks/use-tooltip.ts
index ef66d2d36..c1c49a09b 100644
--- a/apps/mobile/app/hooks/use-tooltip.ts
+++ b/apps/mobile/app/hooks/use-tooltip.ts
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { RefObject, useEffect, useRef } from "react";
import { Platform } from "react-native";
+//@ts-ignore
import RNTooltips from "react-native-tooltips";
import { useThemeColors } from "@notesnook/theme";
import {
diff --git a/apps/mobile/app/navigation/fluid-panels-view.tsx b/apps/mobile/app/navigation/fluid-panels-view.tsx
index 5059ebb02..7af907fe2 100644
--- a/apps/mobile/app/navigation/fluid-panels-view.tsx
+++ b/apps/mobile/app/navigation/fluid-panels-view.tsx
@@ -37,6 +37,7 @@ import {
getSpecificOrientation,
removeOrientationListener,
removeSpecificOrientationListener
+ //@ts-ignore
} from "react-native-orientation";
import Animated, {
useAnimatedStyle,
diff --git a/apps/mobile/app/navigation/navigation-stack.tsx b/apps/mobile/app/navigation/navigation-stack.tsx
index 7e9137097..0262792da 100644
--- a/apps/mobile/app/navigation/navigation-stack.tsx
+++ b/apps/mobile/app/navigation/navigation-stack.tsx
@@ -81,14 +81,14 @@ const AppNavigation = React.memo(
}
}}
>
- <AppStack.Screen name="Notes" component={Home} />
- <AppStack.Screen name="Notebooks" component={Notebooks} />
- <AppStack.Screen name="Favorites" component={Favorites} />
- <AppStack.Screen name="Trash" component={Trash} />
- <AppStack.Screen name="Tags" component={Tags} />
- <AppStack.Screen name="TaggedNotes" component={TaggedNotes} />
- <AppStack.Screen name="ColoredNotes" component={ColoredNotes} />
- <AppStack.Screen name="Reminders" component={Reminders} />
+ <AppStack.Screen name="Notes" component={Home as any} />
+ <AppStack.Screen name="Notebooks" component={Notebooks as any} />
+ <AppStack.Screen name="Favorites" component={Favorites as any} />
+ <AppStack.Screen name="Trash" component={Trash as any} />
+ <AppStack.Screen name="Tags" component={Tags as any} />
+ <AppStack.Screen name="TaggedNotes" component={TaggedNotes as any} />
+ <AppStack.Screen name="ColoredNotes" component={ColoredNotes as any} />
+ <AppStack.Screen name="Reminders" component={Reminders as any} />
<AppStack.Screen
name="Monographs"
initialParams={{
@@ -96,10 +96,10 @@ const AppNavigation = React.memo(
canGoBack: false,
title: strings.monographs()
}}
- component={Monographs}
+ component={Monographs as any}
/>
- <AppStack.Screen name="Notebook" component={NotebookScreen} />
- <AppStack.Screen name="Search" component={Search} />
+ <AppStack.Screen name="Notebook" component={NotebookScreen as any} />
+ <AppStack.Screen name="Search" component={Search as any} />
</AppStack.Navigator>
);
},
diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor.ts b/apps/mobile/app/screens/editor/tiptap/use-editor.ts
index 5c71f1ed8..bd329ffd1 100644
--- a/apps/mobile/app/screens/editor/tiptap/use-editor.ts
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor.ts
@@ -649,7 +649,7 @@ export const useEditor = (
if (lastTabFocused.current !== tabId) return;
- if (tabBarRef.current?.page() === 2) {
+ if (fluidTabsRef.current?.page() === 2) {
state.current.movedAway = false;
}
diff --git a/apps/mobile/app/screens/notebook/index.tsx b/apps/mobile/app/screens/notebook/index.tsx
index 2815d6856..ebefffe37 100644
--- a/apps/mobile/app/screens/notebook/index.tsx
+++ b/apps/mobile/app/screens/notebook/index.tsx
@@ -252,9 +252,10 @@ const NotebookScreen = ({ route, navigation }: NavigationProps<"Notebook">) => {
loading={loading}
CustomLisHeader={
<NotebookHeader
- onEditNotebook={() => {
- AddNotebookSheet.present(params.current.item);
- }}
+ // TODO
+ // onEditNotebook={() => {
+ // AddNotebookSheet.present(params.current.item);
+ // }}
notebook={params.current.item}
totalNotes={notes?.placeholders.length || 0}
/>
diff --git a/apps/mobile/app/screens/notes/index.tsx b/apps/mobile/app/screens/notes/index.tsx
index 7ab2c62b5..bb9a87fe3 100644
--- a/apps/mobile/app/screens/notes/index.tsx
+++ b/apps/mobile/app/screens/notes/index.tsx
@@ -216,9 +216,9 @@ const NotesPage = ({
items: selector
});
}}
- accentColor={accentColor}
+ // accentColor={accentColor}
onPressDefaultRightButton={onPressFloatingButton}
- headerRightButtons={rightButtons?.(params?.current)}
+ // rightButtons={rightButtons?.(params?.current)}
/>
<DelayLayout color={accentColor} wait={loadingNotes}>
diff --git a/apps/mobile/app/screens/settings/theme-selector.tsx b/apps/mobile/app/screens/settings/theme-selector.tsx
index a12d479c8..4a703e5f6 100644
--- a/apps/mobile/app/screens/settings/theme-selector.tsx
+++ b/apps/mobile/app/screens/settings/theme-selector.tsx
@@ -163,7 +163,7 @@ function ThemeSelector() {
>
{MenuItemsList.map((item, index) => (
<View
- key={item.name}
+ key={item.id}
style={{
height: 12,
width: "100%",
@@ -606,7 +606,7 @@ const ThemeSetter = ({
>
{MenuItemsList.map((item, index) => (
<View
- key={item.name}
+ key={item.id}
style={{
height: 12,
width: "100%",
diff --git a/apps/mobile/app/services/intent.ts b/apps/mobile/app/services/intent.ts
index a7264891b..e36de695d 100644
--- a/apps/mobile/app/services/intent.ts
+++ b/apps/mobile/app/services/intent.ts
@@ -21,9 +21,9 @@ import { db } from "../common/database";
import ReminderSheet from "../components/sheets/reminder";
import { setAppState } from "../screens/editor/tiptap/utils";
import { eOnLoadNote } from "../utils/events";
-import { tabBarRef } from "../utils/global-refs";
import { NotesnookModule } from "../utils/notesnook-module";
import { eSendEvent } from "./event-manager";
+import { fluidTabsRef } from "../utils/global-refs";
const launchIntent = Platform.OS === "ios" ? {} : NotesnookModule.getIntent();
let used = false;
@@ -59,7 +59,7 @@ export const IntentService = {
eSendEvent(eOnLoadNote, {
item: note
});
- tabBarRef.current?.goToPage(1, false);
+ fluidTabsRef.current?.goToPage(1, false);
}
} else if (intent["com.streetwriters.notesnook.OpenReminderId"]) {
const reminder = await db.reminders.reminder(
diff --git a/apps/mobile/app/utils/tooltip.ts b/apps/mobile/app/utils/tooltip.ts
index 86d122043..ad75c9b47 100644
--- a/apps/mobile/app/utils/tooltip.ts
+++ b/apps/mobile/app/utils/tooltip.ts
@@ -27,7 +27,7 @@ export const POSITIONS = {
let RNTooltips: any;
let prevTarget: any = null;
function show(event: any, text: string, position = 2) {
- const tabBarRef = require("./global-refs").tabBarRef;
+ const fluidTabsRef = require("./global-refs").fluidTabsRef;
if (!RNTooltips) {
RNTooltips = require("react-native-tooltips").default;
}
@@ -35,7 +35,7 @@ function show(event: any, text: string, position = 2) {
prevTarget && RNTooltips.Dismiss(prevTarget);
prevTarget = null;
prevTarget = event._targetInst.ref.current;
- RNTooltips.Show(prevTarget, tabBarRef.current?.node?.current, {
+ RNTooltips.Show(prevTarget, fluidTabsRef.current?.node?.current, {
text: text,
tintColor: "#000000",
corner: Platform.OS === "ios" ? 5 : 40,