NativeScript / nativescript-imagepicker

Imagepicker plugin supporting both single and multiple selection.
Apache License 2.0
104 stars 73 forks source link

Property scrollDirection already registered for type ListViewLayoutBase. #57

Closed Leo-lay closed 7 years ago

Leo-lay commented 7 years ago

in my project has the lasted nativescript-ui-pro when use

import * as imagepickerModule from 'nativescript-imagepicker'; or let imagepicker = require('nativescript-imagepicker');

ios has appear error

CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2837:32: EXCEPTION: Uncaught (in promise): Error: Property scrollDirection already registered for type ListViewLayoutBase. CONSOLE ERROR file:///app/tns_modules/@angular/core/bundles/core.umd.js:2842:36: ORIGINAL STACKTRACE:

package.json : tns-core-modules:2.4.2

tsonevn commented 7 years ago

Hi @Leo-lay, Could you provide some more info about the problem. I tested your case, however was unable to reproduce this behavior. For testing I used nativescript-ui-samples-angular and install nativescript-imagepicker, however after I import the plugin as it is shown above, I am still unable to reproduce the problem.

It would help if you could provide sample project, which could be debugged locally.

Regards, @tsonevn

kinggolf commented 7 years ago

@tsonevn @Leo-lay Just installed this plugin & came across this same exact issue by running "tns livesync ios --watch" to a device (iPhone6S). Then I switched to simulator and the app started OK. So I went back to a device and ran "tns run ios" without issue. Tried again "tns livesync ios --watch" and got the error.(???) My package.json:

{
  "description": "Cobbl0",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.cobbl.cobbl0",
    "tns-android": {
      "version": "2.4.1"
    },
    "tns-ios": {
      "version": "2.4.0"
    }
  },
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/router": "3.2.1",
    "@ngrx/core": "^1.2.0",
    "@ngrx/store": "^2.2.1",
    "email-validator": "1.0.7",
    "nativescript-angular": "1.2.0",
    "nativescript-camera": "0.0.8",
    "nativescript-fresco": "1.0.12",
    "nativescript-imagepicker": "^2.4.1",
    "nativescript-iqkeyboardmanager": "1.0.1",
    "nativescript-ng2-fonticon": "1.3.3",
    "nativescript-social-share": "1.3.1",
    "nativescript-telerik-analytics": "*",
    "nativescript-telerik-ui": "1.5.1",
    "nativescript-theme-core": "^0.2.1",
    "nativescript-unit-test-runner": "^0.3.4",
    "reflect-metadata": "~0.1.8",
    "rxjs": "5.0.0-beta.12",
    "tns-core-modules": "2.4.2"
  },
  "devDependencies": {
    "babel-traverse": "6.20.0",
    "babel-types": "6.20.0",
    "babylon": "6.14.1",
    "lazy": "1.0.11",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "^0.3.2",
    "typescript": "~2.0.10",
    "zone.js": "~0.6.21"
  }
}
tsonevn commented 7 years ago

Hi @kinggolf,

Could you verify, whether you are using latest NativeScript 2.4.2, while using tns --version? You could try to delete node_modules, platforms, hooks folders and to clear npm cache with npm cache clear. Then try to run your project again with tns livesync ios --watch.

Hope this helps.

Regards, @tsonevn

kinggolf commented 7 years ago

Thank you @tsonevn. Confirmed the project was running NativeScript 2.4.2. I followed your suggestions, removed folders and cleared cache. After npm install and added platforms again tns info showed this:

│ Component        │ Current version │ Latest version │ Information │
│ nativescript     │ 2.4.2           │ 2.4.2          │ Up to date  │
│ tns-core-modules │ 2.4.3           │ 2.4.3          │ Up to date  │
│ tns-android      │ 2.4.1           │ 2.4.1          │ Up to date  │
│ tns-ios          │ 2.4.0           │ 2.4.0          │ Up to date  │

I did update tns-core-modules to 2.4.3, but changed nothing else. tns livesync ios --watch still gave an error as follows - ***** Fatal JavaScript exception - application has been terminated. ***** Native stack trace: 1 0x1005f5dc0 -[TNSRuntime executeModule:referredBy:] tns run ios still works. I always get these warnings with project still working:

CONSOLE WARN file:///app/tns_modules/nativescript-telerik-ui/listview/listview.js:382:14: The TypeScript constructor "TKListViewDataSourceImpl" will not be executed.
CONSOLE WARN file:///app/tns_modules/nativescript-telerik-ui/listview/listview.js:524:14: The TypeScript constructor "ExtendedListViewCell" will not be executed.
gregersen79 commented 7 years ago

After updating image picker to version 2.4.1, I also get the "Property scrollDirection already registered for type ListViewLayoutBase" error:

1  0x10f7b7a6b NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2   0x10ff3790e ffi_closure_unix64_inner
3   0x10ff382c2 ffi_closure_unix64
4   0x10e8439a4 -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:]
5   0x10e86e41e -[UICollectionView touchesEnded:withEvent:]
6   0x110f759c8 -[TKCollectionView touchesEnded:withEvent:]
7   0x10e11d847 forwardTouchMethod
8   0x10e11d910 -[UIResponder touchesEnded:withEvent:]
9   0x110ee3a43 -[TKListViewCell touchesEnded:withEvent:]
10  0x10ff3811d ffi_call_unix64
11  0x12c634b10
file:///app/tns_modules/ui/core/dependency-observable.js:73:28: JS ERROR Error: Property scrollDirection already registered for type ListViewLayoutBase.

tns info:

│ Component        │ Current version │ Latest version │ Information │
│ nativescript     │ 2.4.2           │ 2.4.2          │ Up to date  │
│ tns-core-modules │ 2.4.3           │ 2.4.3          │ Up to date  │
│ tns-android      │ 2.4.1           │ 2.4.1          │ Up to date  │
│ tns-ios          │ 2.4.0           │ 2.4.0          │ Up to date  │

package.json dependencies:

"dependencies": {
    "nativescript-appversion": "1.3.2",
    "nativescript-background-http": "2.4.0",
    "nativescript-google-maps-sdk": "1.4.2",
    "nativescript-imagecropper": "0.0.7",
    "nativescript-imagepicker": "2.4.1",
    "nativescript-ios-uuid": "1.0.0",
    "nativescript-iqkeyboardmanager": "1.0.1",
    "nativescript-local-notifications": "1.2.0",
    "nativescript-permissions": "1.2.2",
    "nativescript-phone": "1.2.3",
    "nativescript-push-notifications": "0.0.19",
    "nativescript-slides": "2.2.5",
    "nativescript-social-share": "1.3.1",
    "nativescript-telerik-ui-pro": "1.5.1",
    "tns-core-modules": "2.4.3"
  },
tsonevn commented 7 years ago

Hi @kinggolf @gregersen79

In my opinion the both problems are different. I was able to reproduce the problem with tns livesync ios --watch while using nativescript-ui-samples-angular project and I opened new issue in nativescript-cli. @kinggolf, you could keep track on new issue.

About the problem, reported from @gregersen79. Could you verify, whether you are using latest nativescript-angular. You could use the below-attached package.json file to verify, whether all dependencies are up to date. After upgrading the nativescript-imagepicker, you should also delete node_modules and platforms folders and then to rebuild the app: tns run <platform name>.

package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.sample"
  },
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/router": "3.2.1",
    "nativescript-angular": "1.2.0",
    "nativescript-theme-core": "^0.2.1",
    "reflect-metadata": "~0.1.8",
    "rxjs": "5.0.0-beta.12",
    "tns-core-modules": "2.4.4"
  },
  "devDependencies": {
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "^0.3.2",
    "typescript": "~2.0.10",
    "zone.js": "~0.6.21"
  }
}

Let me know, whether this helps.

longfay commented 7 years ago

I am having Property scrollDirection already registered for type ListViewLayoutBase. error even with "tns run ios --emulator" command T_T

longfay commented 7 years ago

Ok, I finally installed the image-picker@0.0.6 which solve my problem...