Skip to content

Get ReactNativeScript.render() working #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shirakaba opened this issue Mar 25, 2019 · 1 comment
Closed

Get ReactNativeScript.render() working #1

shirakaba opened this issue Mar 25, 2019 · 1 comment

Comments

@shirakaba
Copy link
Owner

shirakaba commented Mar 25, 2019

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant