Tutorial: TabStack.addView

TabStack.addView

Adds a view to the TabStack and returns the view's identity.

Add a view to a TabStack

if (!fin.me.isView) {
    throw new Error('Not running in a platform View.');
}

const stack = await fin.me.getCurrentStack();
// Alternatively, you can wrap any view and get the stack from there
// const viewFromSomewhere = fin.View.wrapSync(someView.identity);
// const stack = await viewFromSomewhere.getCurrentStack();
const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
console.log('Identity of the google view just added', { googleViewIdentity });
// pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
console.log('Identity of the apple view just added', { appleViewIdentity });