fix-next: undefined root view when reapplying styles (#6729)

* fix: undefined root view when reapplying styles

Error:
```
JS ERROR TypeError: undefined is not an object (evaluating
'application_1.getRootView()._onCssStateChange')
```

Steps:
- `tns run <platform> --hmr`
- make a change in application styles
- restart the application
This commit is contained in:
Vasil Chimev
2018-12-27 16:44:24 +02:00
committed by GitHub
parent 8a32102fa1
commit 2b7e7d89e0

View File

@@ -89,8 +89,9 @@ export function livesync(context?: HmrContext) {
reapplyAppCss = extensions.some(ext => context.module === fileName.concat(ext));
}
if (reapplyAppCss) {
getRootView()._onCssStateChange();
const rootView = getRootView();
if (reapplyAppCss && rootView) {
rootView._onCssStateChange();
} else if (liveSyncCore) {
liveSyncCore();
}