【问题标题】:Why showModal is showing fullscreen in iOS?为什么 showModal 在 iOS 中显示全屏?
【发布时间】:2016-12-28 05:37:22
【问题描述】:

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 中将其修复为页面大小?

【问题讨论】:

    标签: javascript android ios xml nativescript


    【解决方案1】:

    提示:根据 iPhone 的设计,模态页面仅以全屏显示。

    参考:https://docs.nativescript.org/core-concepts/navigation#modal-pages

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-20
      • 2016-03-08
      • 1970-01-01
      相关资源
      最近更新 更多