mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 09:03:25 +00:00
format and remove unused externallink component
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { Platform } from "react-native";
|
|
||||||
import { Link } from "expo-router";
|
|
||||||
import * as WebBrowser from "expo-web-browser";
|
|
||||||
|
|
||||||
export function ExternalLink(
|
|
||||||
props: Omit<React.ComponentProps<typeof Link>, "href"> & { href: string },
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
hrefAttrs={{
|
|
||||||
// On web, launch the link in a new tab.
|
|
||||||
target: "_blank",
|
|
||||||
}}
|
|
||||||
{...props}
|
|
||||||
// @ts-expect-error href is not a valid prop for Link, but we're using it here to pass the URL to the web browser.
|
|
||||||
href={props.href}
|
|
||||||
onPress={(e) => {
|
|
||||||
if (Platform.OS !== "web") {
|
|
||||||
// Prevent the default behavior of linking to the default browser on native.
|
|
||||||
e.preventDefault();
|
|
||||||
// Open the link in an in-app browser.
|
|
||||||
WebBrowser.openBrowserAsync(props.href).catch((error) => {
|
|
||||||
console.error("Failed to open browser", error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
@@ -5,12 +5,12 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./src/*"],
|
"~/*": ["./src/*"],
|
||||||
"~/components/*": ["./src/app/components/*"]
|
"~/components/*": ["./src/app/components/*"],
|
||||||
},
|
},
|
||||||
"jsx": "react-native",
|
"jsx": "react-native",
|
||||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
|
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
|
||||||
"types": ["nativewind/types"]
|
"types": ["nativewind/types"],
|
||||||
},
|
},
|
||||||
"include": ["src", "*.ts", "*.js", ".expo/types/**/*.ts", "expo-env.d.ts"],
|
"include": ["src", "*.ts", "*.js", ".expo/types/**/*.ts", "expo-env.d.ts"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"],
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "@movie-web/tsconfig/base.json",
|
"extends": "@movie-web/tsconfig/base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
|
||||||
},
|
},
|
||||||
"include": ["."],
|
"include": ["."],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"],
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "@movie-web/tsconfig/base.json",
|
"extends": "@movie-web/tsconfig/base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
|
||||||
},
|
},
|
||||||
"include": ["."],
|
"include": ["."],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"],
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "@movie-web/tsconfig/base.json",
|
"extends": "@movie-web/tsconfig/base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
|
||||||
},
|
},
|
||||||
"include": ["."],
|
"include": ["."],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"],
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user