Skip to content

Get ReactNativeScript.render() working #1

@shirakaba

Description

@shirakaba

ReactNativeScript.render() needs a root node (AKA container) to render into. Thus, I need to get a reference to the application's root view at startup time (which I'll use as the React root). However, I'm facing difficulties:

/* app.ts */
import { on, run, launchEvent, getRootView } from "tns-core-modules/application";

console.log(getRootView());
// application root view is undefined

on(launchEvent, (data) => {
    console.log(data.root);
    // application launch event's data.root is undefined
});
run();

Clearly I am misunderstanding the application lifecycle here. Wondering how I get a reference to the root view (frame) of the app at startup.

References:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions