ios icon indicating copy to clipboard operation
ios copied to clipboard

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

Open mapo80 opened this issue 4 years ago • 2 comments

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 avatar Jul 15 '20 07:07 mapo80

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;'
             },
           }],
       });

mapo80 avatar Jul 15 '20 08:07 mapo80

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

rigor789 avatar Sep 09 '20 21:09 rigor789