Skip to content

Cannot read property 'addEventListener' of undefined #87

Open

Description

@PetroSuch

I have an error when using DateTimePickerFields, could somebody help me with my question, please ?

TypeError: Cannot read property 'addEventListener' of undefined
JS: at DateTimePickerFields.addEventListener (file: src\webpack:@NativeScript\template-hello-world-ng\node_modules@nativescript\datetimepicker\ui\date-time-picker-fields.js:105:0)
JS: at DateTimePickerFields.on (file: src\webpack:@NativeScript\template-hello-world-ng\node_modules@nativescript\core\data\observable\index.js:49:0)

here is my package.json

"dependencies": {
"@angular/animations": "~11.2.7",
"@angular/common": "~11.2.7",
"@angular/compiler": "~11.2.7",
"@angular/core": "~11.2.7",
"@angular/forms": "~11.2.7",
"@angular/platform-browser": "~11.2.7",
"@angular/platform-browser-dynamic": "~11.2.7",
"@angular/router": "~11.2.7",
"@nativescript/angular": "~11.8.0",
"@nativescript/background-http": "^5.0.2",
"@nativescript/camera": "^5.0.8",
"@nativescript/core": "~8.0.0",
"@nativescript/datetimepicker": "^2.1.3",
"@nativescript/fingerprint-auth": "^7.0.0",
"@nativescript/imagepicker": "^1.0.4",
"@nativescript/local-notifications": "^5.0.3",
"@nativescript/theme": "~3.0.1",
"@nativescript/ui-charts": "^0.1.0",
"@nstudio/nativescript-checkbox": "^2.0.4",
"@nstudio/nativescript-pulltorefresh": "^3.0.1",
"moment": "^2.29.1",
"nativescript-barcodescanner": "^4.1.1",
"nativescript-carousel": "^7.0.1",
"nativescript-clipboard": "^2.1.1",
"nativescript-feedback": "^2.0.0",
"nativescript-localstorage": "^2.0.2",
"nativescript-permissions": "^1.3.11",
"nativescript-ui-chart": "^8.0.2",
"reflect-metadata": "~0.1.13",
"rxjs": "~6.6.7",
"save": "^2.4.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular/compiler-cli": "~11.2.7",
"@nativescript/android": "8.0.0",
"@nativescript/types": "~8.0.0",
"@nativescript/webpack": "beta",
"@ngtools/webpack": "~11.2.6",
"typescript": "~4.0.0"
},

Activity

  1. PetroSuch commented on May 18, 2021

    @PetroSuch
    Author

    i changed function in file @nativescript/datetimepicker/ui/date-time-picker.js

     addEventListener(eventNames, callback, thisArg) {
            try{
                super.addEventListener(eventNames, callback, thisArg);
                this.dateField.addEventListener(eventNames, callback, thisArg);
                this.timeField.addEventListener(eventNames, callback, thisArg);
            }catch(err){}
        }
    

    and it fixed my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions