Fix replace behavior on android

This commit is contained in:
Zoe Roux 2024-03-25 00:06:57 +01:00
parent f352085f62
commit c5b0a76982
No known key found for this signature in database
5 changed files with 10 additions and 10 deletions

View File

@ -49,7 +49,7 @@ export const A = ({
replace
? {
nativeBehavior: "stack-replace",
isNestedNavigator: false,
isNestedNavigator: true,
}
: undefined
}
@ -105,7 +105,7 @@ export const Link = ({
const linkProps = useLink({
href: href ?? "#",
replace,
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
// @ts-ignore Missing hrefAttrs type definition.
linkProps.hrefAttrs = { ...linkProps.hrefAttrs, target };

View File

@ -46,7 +46,7 @@ export const LoginPage: QueryPage<{ apiUrl?: string; error?: string }> = ({
useEffect(() => {
if (!apiUrl && Platform.OS !== "web")
router.replace("/server-url", undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
}, [apiUrl, router]);
@ -74,7 +74,7 @@ export const LoginPage: QueryPage<{ apiUrl?: string; error?: string }> = ({
setError(error);
if (error) return;
router.replace("/", undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
}}
{...css({

View File

@ -106,7 +106,7 @@ export const OidcCallbackPage: QueryPage<{
function onError(error: string) {
router.replace({ pathname: "/login", query: { error, apiUrl } }, undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
}
async function run() {
@ -114,7 +114,7 @@ export const OidcCallbackPage: QueryPage<{
if (loginError) onError(loginError);
else {
router.replace("/", undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
}
}

View File

@ -45,7 +45,7 @@ export const RegisterPage: QueryPage<{ apiUrl?: string }> = ({ apiUrl }) => {
useEffect(() => {
if (!apiUrl && Platform.OS !== "web")
router.replace("/server-url", undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
}, [apiUrl, router]);
@ -85,7 +85,7 @@ export const RegisterPage: QueryPage<{ apiUrl?: string }> = ({ apiUrl }) => {
setError(error);
if (error) return;
router.replace("/", undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
}}
{...css({

View File

@ -157,11 +157,11 @@ export const Player = ({
if (!data) return;
if (data.type === "movie")
router.replace(`/movie/${data.slug}`, undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
else
router.replace(next ?? `/show/${data.show!.slug}`, undefined, {
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: false },
experimental: { nativeBehavior: "stack-replace", isNestedNavigator: true },
});
}}
{...css(StyleSheet.absoluteFillObject)}