mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-03 23:23:21 +00:00
- watch listeners receive { type: "changed" } | { type: "deleted" }, so later
versions can add fields without breaking them.
- PluginFileDeletedError joins PluginFileConflictError. The read hooks report a
deleted file with it, and a write over a deleted file rejects with it; Source
shows that as the deleted notice. PluginFileConflictError now means only
"changed on disk".
- DocumentFrame on Android shows Paseo's "<TYPE> files can't be shown on this
device" message for documents its WebView cannot display, so the PDF example
is useFileUrl + Loading + DocumentFrame with no platform branch.
26 lines
801 B
TypeScript
26 lines
801 B
TypeScript
import { type PluginFilePanelProps, useFileUrl } from "@getpaseo/plugin/client";
|
|
import { DocumentFrame, Loading } from "@getpaseo/plugin/client/ui";
|
|
import { useMemo } from "react";
|
|
import { Text, View } from "react-native";
|
|
|
|
const messageStyle = {
|
|
flex: 1,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
padding: 24,
|
|
} as const;
|
|
|
|
export function PdfPanel({ file, theme }: PluginFilePanelProps) {
|
|
const url = useFileUrl(file);
|
|
const textStyle = useMemo(() => ({ color: theme.colors.statusDanger }), [theme]);
|
|
if (url.status === "loading") return <Loading />;
|
|
if (url.status === "error") {
|
|
return (
|
|
<View style={messageStyle}>
|
|
<Text style={textStyle}>{url.error.message}</Text>
|
|
</View>
|
|
);
|
|
}
|
|
return <DocumentFrame url={url.url} testID="pdf-panel" />;
|
|
}
|