Hello,
I noticed that the WhileActive
is not being fired for the first time when you visit a page, it starts working on the second visit.
A simple project file that can be reproduce the behavior.
MainView.ux
<App>
<Router ux:Name="router" />
<Navigator DefaultTemplate="Home" Background="#000000">
<Home ux:Template="Home" router="router" />
<Search ux:Template="Search" router="router"/>
</Navigator>
<Page ux:Class="Home" Background="#ffffff">
<Router ux:Dependency="router" />
<JavaScript>
module.exports.Search = function() {
router.push('Search');
}
</JavaScript>
<WhileActive>
<DebugAction Message="Home"/>
</WhileActive>
<Button Height="50" Width="300" Background="Black" Clicked="{Search}">
<Text TextAlignment="Center" Alignment="Center" Color="White">Go to Search</Text>
</Button>
</Page>
<Page ux:Class="Search">
<Router ux:Dependency="router" />
<JavaScript>
module.exports.GoBack = function() {
router.goBack();
}
</JavaScript>
<WhileActive>
<DebugAction Message="Search"/>
</WhileActive>
<Button Height="50" Width="300" Background="White" Clicked="{GoBack}">
<Text TextAlignment="Center" Alignment="Center" Color="Black">Go back to Home Page</Text>
</Button>
</Page>
</App>