未呈现本机IOS 13 ui-listview组件

问题描述 投票:0回答:1

嗨,我在IOS13上的listview组件遇到问题我尝试更新到最新版本,但这不起作用

我通过直接在node_modules中修补listview.ios.js来修复它就像这里的评论建议的一样:

https://github.com/NativeScript/nativescript-ui-feedback/issues/1160#issuecomment-542039004

这很好,但是是否有任何其他修补方法?

例如:

我尝试创建新文件app-platform.ios.js

并将缺少的方法直接附加到列表视图,例如:

const listview = require('nativescript-ui-listview');

listview.ListViewCell.prototype.systemLayoutSizeFittingSizeWithHorizontalFittingPriorityVerticalFittingPriority = function (targetSize, horizontalFittingPriority, verticalFittingPriority) {
    if (this.view && this.view.itemView && this.view.itemView.parent) {
        var owner = this.view.itemView.parent;
        owner._preparingCell = true;
        var dimensions = owner.layoutCell(this, undefined);
        owner._preparingCell = false;
        return CGSizeMake(view_1.layout.toDeviceIndependentPixels(dimensions.measuredWidth), view_1.layout.toDeviceIndependentPixels(dimensions.measuredHeight));
    }
    return targetSize;
};

但是这使我的应用崩溃,我无法在未定义的方法上调用方法:/

nativescript angular2-nativescript nativescript-telerik-ui nativescript-plugin
1个回答
0
投票
[如果有人仍然需要这个,可以设法在main.js路径列表视图中解决这个。

const application = require('application'); if (application.ios) { const view_1 = require("tns-core-modules/ui/core/view"); const listView = require('nativescript-ui-listview'); listView.ExtendedListViewCell.prototype.systemLayoutSizeFittingSizeWithHorizontalFittingPriorityVerticalFittingPriority = function (targetSize, horizontalFittingPriority, verticalFittingPriority) { if (this.view && this.view.itemView && this.view.itemView.parent) { var owner = this.view.itemView.parent; owner._preparingCell = true; var dimensions = owner.layoutCell(this, undefined); owner._preparingCell = false; return CGSizeMake( view_1.layout.toDeviceIndependentPixels(dimensions.measuredWidth), view_1.layout.toDeviceIndependentPixels(dimensions.measuredHeight) ); } return targetSize; }; }

© www.soinside.com 2019 - 2024. All rights reserved.