Tutorial: Platform.reparentView

Platform.reparentView

Reparents a specified view in a new target window.

Example

let { identity } = fin.Window.getCurrentSync();
let platform = fin.Layout.getCurrentSync();
let viewOptions = {
    name: 'example_view',
    url: 'https://example.com'
};
// a new view will now show in the current window
await platform.createView(viewOptions, identity);

// create a new window
await platform.createWindow({
    uuid: identity.uuid,
    name: 'test_win',
    layout: {
        content: [
            {
                type: "stack",
                content: [
                    {
                        type: "component",
                        componentName: "view",
                        componentState: {
                            name: "yahoo_view",
                            url: "https://yahoo.com"
                        }
                    }
                ]
            }
        ]
    }
}).then(console.log);

let viewIdentity = { uuid: identity.uuid, name: 'example_view'};
let target = {uuid: identity.uuid, name: 'test_win'};
platform.reparentView(viewIdentity, target);