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.
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: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: