Error: ActionItem is not a valid View instance


#1

I have the following template:

<Page.actionBar>
    <ActionBar title="Modules" automationText="ActionBar">
        <NavigationButton icon="res://back_btn" tap="goBack" automationText="GoBack"></NavigationButton>
        <Android>
            <ActionItem id="exampleMenuButton" icon="res://menu" automationText="ExampleMenu"></ActionItem>
        </Android>
        <iOS>
            <ActionItem id="exampleMenuButton" ios.position="right" automationText="ExampleMenu">
                <ActionItem.actionView>
                    <Image src="res://menu" width="22" height="22" margin="0, -11, 0, 11"></Image>
                </ActionItem.actionView>
            </ActionItem>
        </iOS>
    </ActionBar>
</Page.actionBar>

The code comes from nativescript-marketplace-demo. First I had to change tags to be not self-closed, because of Only void and foreign elements can be self closed "NavigationButton" and now get the error seen below, why?

CONSOLE ERROR file:///app/vendor.js:1688:24: ERROR Error: Uncaught (in promise): Error: ActionItem is not a valid View instance.
	_addView@file:///app/vendor.js:77124:28 [angular]
	addChild@file:///app/vendor.js:79138:22 [angular]
	insertChild@file:///app/vendor.js:58553:32 [angular]
	appendChild@file:///app/vendor.js:57775:38 [angular]
	appendChild@file:///app/vendor.js:13726:34 [angular]
	createElement@file:///app/vendor.js:9925:33 [angular]
	createViewNodes@file:///app/vendor.js:12532:57 [angular]
	callViewAction@file:///app/vendor.js:12944:28 [angular]
	execComponentViewsAction@file:///app/vendor.js:12883:27 [angular]
	createViewNodes@file:///app/vendor.js:12601:29 [angular]
	createRootView@file:///app/vendor.js:12479:20 [angular]
	callWithDebugContext@file:///app/vendor.js:13610:47 [angular]
	create@file:///app/vendor.js:10415:60 [angular]
	createComponent@file:///app/vendor.js:10615:68 [angular]
	activateOnGoForward@file:///app/vendor.js:48567:70 [angular]
	activateWith@file:///app/vendor.js:48553:37 [angular]
	placeComponentIntoOutlet@file:///app/vendor.js:23184:28 [angular]
	activateRoutes@file:///app/vendor.js:23165:50 [angular]
	file:///app/vendor.js:23101:72 [angular]
	forEach@[native code] [angular]
	activateChildRoutes@file:///app/vendor.js:23101:36 [angular]
	activate@file:///app/vendor.js:23075:33 [angular]
	file:///app/vendor.js:22692:30 [angular]
	file:///app/vendor.js:230:25 [angular]
    ...

#2

Here’s helpful Nathanael’s response to this topic on stackoverflow: http://stackoverflow.com/questions/43645484/error-actionitem-is-not-a-valid-view-instance/43647875#43647875


#3

Did that response solve your problem?


#4

No at all, I just know I was trying to do it in wrong way, but still don’t know the right one… Anyway, I’d close this topic.