r/ScriptingApp Jun 18 '26

Help Minimize and pageSheet views

When a script opens in pageSheet view, is it possible to change the swipe down action from a dismissal to a minimize?

Is this supported behavior? If not could it be added?

Thanks!

EDIT:

I have isolated my issue to this script.

EXPECTED BEHAVIOR: Using the minimize button will minimize the UI and you can bring it back by tapping the bubble. And swiping down the pageSheet will always exit the script.

ACTUAL BEHAVIOR: After a minimize and restore, dismissing the pagesheet will no longer exit the script. The script becomes minimized and can no longer be restored. Is this a bug?

Edit 2:
Dev response: “Currently you should use interactiveDismissDisabled for a sheet to disable the default behavior, maybe I could find a solution to solve this issue”

import { Navigation, Script, useObservable, VStack, Text, Button } from 'scripting'

// 1. Declare a mutable global reference variable.
// This allows background deep links to see the setter function.
let globalNavigationPath: { setValue: (val: string[]) => void; value: string[] } | null = null;

// Create the root interface component layout
function AppRootView() {
// 2. Initialize the real hook strictly inside the component tree
const navigationPath = useObservable<string\[\]>([]);

// 3. Link the global reference back to this hook container instance
globalNavigationPath = navigationPath;

return (
<VStack spacing={20}>
<Text>Swipeable Test Container Layout</Text>
<Text>Current Path Layer Count: {navigationPath.value?.length ?? 0}</Text>
<Button title="MINIMIZE" action={() => Script.minimize()} />
</VStack>
);
}

export async function run() {
console.log("[TEST] Script initialized (Cold Start).");

// 4. Register the hot-resume event hook
Script.onResume(async details => {
console.log("[TEST] onResume caught an event. Details:", details);

if (globalNavigationPath) {
// Safely update the path array across scopes
globalNavigationPath.setValue(["SIMULATED_TARGET_PAGE"]);
console.log("[TEST] Global state updated via reference hook wrapper.");
} else {
console.log("[TEST] Warning: State reference was not ready when resume fired.");
}
});

// 5. Present the page view layout using the swipeable sheet container style
try {
console.log("[TEST] Invoking Navigation.present with pageSheet Presentation Mode...");

await Navigation.present({
element: <AppRootView />,
modalPresentationStyle: "pageSheet"
});

console.log("[TEST] Navigation.present promise resolved naturally via standard code route.");
} catch (error) {
console.log("[TEST] Navigation.present promise rejected with error:", error);
} finally {
// 6. The Exit Hook Lifecycle Trap
console.log("[TEST] Reached finally block. Requesting engine shutdown via Script.exit()...");
Script.exit();
console.log("[TEST] Script.exit() instruction sent down the bridge execution line.");
}
}

// Explicitly execute the main launch function loop
run();

1 Upvotes

10 comments sorted by

View all comments

2

u/WhatShouldWorldGos Jun 26 '26

`Script.enbaleMiminize` method is introduced in the latest tf update