From c6f9a5e56fde156a03b3ab4b06454faed5e0b518 Mon Sep 17 00:00:00 2001 From: rigor789 Date: Wed, 11 Mar 2020 17:21:08 +0100 Subject: [PATCH] feat(ActionBar): warn when not a direct child of Page --- packages/runtime/src/components/ActionBar.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/runtime/src/components/ActionBar.ts b/packages/runtime/src/components/ActionBar.ts index 64ccaeda..d8990040 100644 --- a/packages/runtime/src/components/ActionBar.ts +++ b/packages/runtime/src/components/ActionBar.ts @@ -1,4 +1,4 @@ -import { FunctionalComponent, h } from '@vue/runtime-core' +import { FunctionalComponent, h, warn } from '@vue/runtime-core' import { NSVElement } from '../nodes' import { ActionBar as TNSActionBar, @@ -59,7 +59,12 @@ export const ActionBar: FunctionalComponent = (props, ctx) => { if (parent.nativeView instanceof TNSPage) { parent.nativeView.actionBar = actionBar } else { - // todo: warn ActionBar must be a direct child of + if (__DEV__) { + warn( + ` must be a direct child of a element - ` + + `got <${parent.nativeView.constructor.name}> instead.` + ) + } } } },