NativeScript / ios

NativeScript for iOS and visionOS using V8
https://docs.nativescript.org/guide/ios-marshalling
131 stars 33 forks source link

[BUG] - Problem on modal - Error: Attempted to assign to readonly property. #53

Open mapo80 opened 4 years ago

mapo80 commented 4 years ago

Hi guys, because I need to enable Bitcode I've adopted new runtime and I succeeded to enable it. With new runtime I have some crashes and issues.

If I open a modal I have this log and modals do not open:

CONSOLE ERROR: ERROR Error: Uncaught (in promise): Error: Attempted to assign to readonly property.
Error: Attempted to assign to readonly property.
at GridLayout.push.../node_modules/@nativescript/core/ui/core/view/view.js.View._showNativeModalView (file: node_modules/@nativescript/core/ui/core/view/view.ios.js:370:0)
at ProxyViewContainer.push.../node_modules/@nativescript/core/ui/core/view/view-common.js.ViewCommon.showModal (file: node_modules/@nativescript/core/ui/core/view/view-common.js:283:0)
at file: node_modules/@nativescript/angular/directives/dialogs.js:99:0
at ZoneDelegate.push.../node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js.ZoneDelegate.invoke (file: node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js:388:0)
at Object.onInvoke (file: node_modules/@angular/core/fesm5/core.js:26256:0)
at ZoneDelegate.push.../node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js.ZoneDelegate.invoke (file: node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js:387:0)
at Zone.push.../node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js.Zone.run (file: node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js:138:0)
at file: node_modules/@nativescript/angular/zone-js/dist/zone-nativescript.js:883:0
at ZoneDele<…>

Problem is on these line:

controller.animated = animated;

Thanks for your help and support.

mapo80 commented 4 years ago

Guys I've implemented a workaround but this can't be the final fix. I've changed source code during webpack operations in this way:

       config.module.rules.unshift({
            test: /@nativescript\/core\/ui\/core\/view\/view\.js$/,
            use: [{
              loader: 'string-replace-loader',
              options: {
                search: new RegExp("controller.animated = animated;", 'g'),
                replace: '/*controller.animated = animated;*/'
              },
            }],
        });

        config.module.rules.unshift({
            test: /@nativescript\/core\/ui\/core\/view\/view\.js$/,
            use: [{
              loader: 'string-replace-loader',
              options: {
                search: new RegExp("var animated = this\.viewController\.animated", 'g'),
                replace: 'var animated = true;'
              },
            }],
        });
rigor789 commented 4 years ago

@mapo80 I believe this has been fixed in https://github.com/NativeScript/NativeScript/commit/967d652c61fbeed6c7e8bd568c893d40308b5b58