Open History to see the last commit
1import { useNavigation } from "@react-navigation/native";
2
3import { useOpenThreadInspector } from "../threads/thread-inspector-navigation";
4
5/** Opens an environment's localhost page on this device: in the inspector pane where there is one. */
6export function useOpenLocalPreview() {
7 const navigation = useNavigation();
8 const openInspector = useOpenThreadInspector();
9 return (source: { readonly environmentId: string; readonly threadId: string }, url: string) => {
10 if (openInspector(source, { type: "localPreview", ...source, url })) return;
11 navigation.navigate("ThreadLocalPreview", { environmentId: source.environmentId, url });
12 };
13}