mobile: fix tsc errors

This commit is contained in:
Ammar Ahmed
2025-02-06 10:59:29 +05:00
parent b208a468c4
commit 229488eb29
15 changed files with 62 additions and 59 deletions

View File

@@ -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

View File

@@ -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;
};

View File

@@ -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,

View File

@@ -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({

View File

@@ -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;
}

View File

@@ -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: {

View File

@@ -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 {

View File

@@ -37,6 +37,7 @@ import {
getSpecificOrientation,
removeOrientationListener,
removeSpecificOrientationListener
//@ts-ignore
} from "react-native-orientation";
import Animated, {
useAnimatedStyle,

View File

@@ -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>
);
},

View File

@@ -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;
}

View File

@@ -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}
/>

View File

@@ -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}>

View File

@@ -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%",

View File

@@ -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(

View File

@@ -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,