new.xml
<Page xmlns="http://www.nativescript.org/tns.xsd"
showingModally="onLoaded">
<StackLayout id="newUserModal" width="100%" height="auto" horizontalAlignment="center" verticalAlignment="center" backgroundColor="#F3F3F3" opacity="1">
<StackLayout class="dialog-header">
<label text="New User" />
</StackLayout>
<label class="header-line" />
<StackLayout class="modal-row">
<WrapLayout>
<Label text="Name" class="modal-row-label" />
<Label text="*" class="required-field" />
</WrapLayout>
<TextField id="user_Name" editable="true" text="" class="modal-row-textfield" />
</StackLayout>
<StackLayout class="modal-row">
<WrapLayout>
<Label text="Email" class="modal-row-label" />
<Label text="*" class="required-field" />
</WrapLayout>
<TextField id="user_Email" editable="true" text="" class="modal-row-textfield" />
</StackLayout>
<StackLayout class="modal-row">
<WrapLayout>
<Label text="Username" class="modal-row-label" />
<Label text="*" class="required-field" />
</WrapLayout>
<TextField id="user_userName" editable="true" text="" class="modal-row-textfield" />
</StackLayout>
<StackLayout class="modal-row">
<WrapLayout>
<Label text="Password" class="modal-row-label" />
<Label text="*" class="required-field" />
</WrapLayout>
<TextField id="user_Password" editable="true" text="" secure="true" class="new-user-password" />
</StackLayout>
<GridLayout columns="*, 1, *" rows="auto">
<label class="footer-button-cancel" text="Cancel" tap="dismiss" col="0" />
<label class="footer-button-submit" text="Add" tap="submit" col="2"/>
</GridLayout>
</StackLayout>
</Page>
JS
var NewUserModule = 'components/users/dialogs/new';
var context = {
args: args
};
var fullscreen = false;
page.showModal(NewUserModule, context, function closeCallback(user_Name, user_Email, user_userName, user_Password, isChecked) {
if (user_Name && user_Email && user_userName && user_Password) {
updateList
.addUser(user_Name, user_Email, user_userName, user_Password, isChecked)
.catch(function (error) {
// helpers.handleLoadError(error, 'Sorry, we could not add user');
})
.then(function () {
loadUser();
});
}
}, fullscreen);
在上面的代码中,我在iOS中获得全屏模式,而在android中,页面尺寸变大。如何在iOS中将其调整为页面大小?
最佳答案
提示:根据设计,在iPhone上,模式页面仅在全屏模式下显示。
参考:https://docs.nativescript.org/core-concepts/navigation#modal-pages
关于javascript - 为什么showModal在iOS中全屏显示?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41355962/