mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): nested dialog/fragment handling (#9495)
This commit is contained in:
24
apps/ui/src/modal-view/nested-modal-tab.xml
Normal file
24
apps/ui/src/modal-view/nested-modal-tab.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
|
||||
|
||||
<ActionBar>
|
||||
<Label text="Nested Modal Tab"></Label>
|
||||
</ActionBar>
|
||||
|
||||
<TabView selectedTabTextColor="green">
|
||||
<TabViewItem title="First">
|
||||
<GridLayout>
|
||||
<Frame id="nestedFrame" defaultPage="nested-frames/nested-page" actionBarVisibility="always"></Frame>
|
||||
</GridLayout>
|
||||
</TabViewItem>
|
||||
<TabViewItem title="Second">
|
||||
<GridLayout>
|
||||
<Frame id="nestedFrame" defaultPage="nested-frames/nested-page" actionBarVisibility="always"></Frame>
|
||||
</GridLayout>
|
||||
</TabViewItem>
|
||||
<TabViewItem title="Third">
|
||||
<GridLayout>
|
||||
<Frame id="nestedFrame" defaultPage="nested-frames/nested-page" actionBarVisibility="always"></Frame>
|
||||
</GridLayout>
|
||||
</TabViewItem>
|
||||
</TabView>
|
||||
</Page>
|
||||
@@ -9,6 +9,14 @@ export function onShowingModally(args: ShownModallyData) {
|
||||
onTap: function () {
|
||||
Dialogs.alert('it works!');
|
||||
},
|
||||
openNestedModal: function () {
|
||||
page.showModal('modal-view/nested-nested-modal', {
|
||||
context: 'Neste mODAL',
|
||||
closeCallback: () => {
|
||||
console.log('nested-modal.openNestedModal');
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<StackLayout backgroundColor="PaleGreen" margin="10">
|
||||
<Label text="{{ context }}"/>
|
||||
<Button text="Show Alert" tap="{{ onTap }}"/>
|
||||
<Button text="Open Nested Modal" tap="{{ openNestedModal }}"/>
|
||||
</StackLayout>
|
||||
</Page>
|
||||
|
||||
29
apps/ui/src/modal-view/nested-nested-frame.ts
Normal file
29
apps/ui/src/modal-view/nested-nested-frame.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Page, EventData, fromObject, Dialogs } from '@nativescript/core';
|
||||
|
||||
export function navigatingTo(args) {
|
||||
const page = <Page>args.object;
|
||||
|
||||
page.bindingContext = fromObject({
|
||||
context: args.context,
|
||||
onTap: function () {
|
||||
Dialogs.alert('it works!');
|
||||
},
|
||||
openNestedFrames: function () {
|
||||
page.showModal('modal-view/nested-modal-tab', {
|
||||
context: 'Nested Modal Tab',
|
||||
fullscreen: true,
|
||||
closeCallback: () => {
|
||||
console.log('nested-modal.openNestedModal');
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function onLoaded(args: EventData) {
|
||||
console.log('nested-nested-modal.onLoaded');
|
||||
}
|
||||
|
||||
export function onUnloaded() {
|
||||
console.log('nested-nested-modal.onUnloaded');
|
||||
}
|
||||
9
apps/ui/src/modal-view/nested-nested-frame.xml
Normal file
9
apps/ui/src/modal-view/nested-nested-frame.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
|
||||
navigatingTo="navigatingTo"
|
||||
loaded="onLoaded" unloaded="onUnloaded" backgroundColor="Red">
|
||||
<StackLayout backgroundColor="PaleGreen" margin="10">
|
||||
<Label text="{{ context }}"/>
|
||||
<Button text="Show Alert" tap="{{ onTap }}"/>
|
||||
<Button text="Open Nested Frames" tap="{{ openNestedFrames }}" />
|
||||
</StackLayout>
|
||||
</Page>
|
||||
1
apps/ui/src/modal-view/nested-nested-modal.xml
Normal file
1
apps/ui/src/modal-view/nested-nested-modal.xml
Normal file
@@ -0,0 +1 @@
|
||||
<Frame defaultPage="modal-view/nested-nested-frame"></Frame>
|
||||
Reference in New Issue
Block a user