Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Object(...) is not a function in ngx-color.js:895 #128

Closed
lscarneiro opened this issue Jun 4, 2018 · 10 comments
Closed

TypeError: Object(...) is not a function in ngx-color.js:895 #128

lscarneiro opened this issue Jun 4, 2018 · 10 comments

Comments

@lscarneiro
Copy link

Hello there,
I am getting some errors with the basic implementation of this component.

I'm using:

Ionic Framework: 3.9.2
Ionic App Scripts: 3.1.8
Angular Core: 5.2.9
Angular Compiler CLI: 5.2.9
Node: 9.11.1
OS Platform: macOS Sierra
Navigator Platform: MacIntel
User Agent: Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Mobile Safari/537.36

First I tried <color-slider></color-slider> (with and without color and (onChange) set) and got an exception every time I clicked in the slider, and of course, couldn't drag the slider itself.

Then I tried <color-alpha-picker></color-alpha-picker>, got the same exception that occurs in this part of the code (line 895 of ngx-color.js):

  this.mousemove = fromEvent(document, 'mousemove')
            .subscribe(function (e) { return _this.handleMousemove(e); });

It seems that fromEvent object is not defined.

When I finally tried <color-sketch></color-sketch> I still got the same exception, but only when clicked in the two bottom sliders.

Would love if you could give any hint to help me solve this problem.

Thanks in advance

@scttcper
Copy link
Owner

scttcper commented Jun 4, 2018

What version of rxjs do you have?

@lscarneiro
Copy link
Author

Good question, I didn't installed rxjs directly to this project, because it's a tiny hobby one that I'm testing, but yeah, I didn't tried to npm install rxjs directly, but it is inside my node_modules, so I thought that your package required it directly...

The on inside my node_modules is rxjs@5.5.8

@scttcper
Copy link
Owner

scttcper commented Jun 4, 2018

you'll need rxjs > 6. Most angular library's list it as a peer dependency and it should show a warning on npm install.

@lscarneiro
Copy link
Author

lscarneiro commented Jun 5, 2018

Looked here, yes, ionic does demand rxjs by itself, but an earlier version, that is why my rxjs is at v5.5.8...

Looks like I have to wait for a new ionic release with rxjs v6 support, amirite?

Do some earlier version of your ngx-color support rxjs<6?

Thank your for your support

@lscarneiro
Copy link
Author

Just checked here, looks like v1.2.1 supports rxjs@5.5.6, gonna try it out!

@lscarneiro
Copy link
Author

So, I got it to work on 1.2.1 with "no errors", but can't drag the sliders if I'm mobile mode on chrome, I can only click inside the slider bar and then the slider jumps to the clicked position... Any ideas? =/

@scttcper
Copy link
Owner

scttcper commented Jun 6, 2018

I've just released v2 which should solve mobile issues. However you would need rxjs 6.

I think you could try npm i rxjs@5.6.0-forward-compat.5 --save along with ngx-color v2

@lscarneiro
Copy link
Author

Hey man, thanks again for your support, I tried ngx-color v2 with this specific version of rxjs and it worked, thanks!

Now, I struggled trying to make the draggable items work on my iPhone, it seems to work only on my desktop browser... As I said, I'm using ionic, at this point I don't know who to blame, hahaha.

Do you have any hint?

Thanks again for your time!

@scttcper
Copy link
Owner

Does the demo work on your iphone? https://scttcper.github.io/ngx-color/

If it does it might be something with ionic

@lscarneiro
Copy link
Author

How dumb was I... Should've tested the demo on my phone first hahaha!

Yeah, it works really fine with the demo, gonna find a reason why ionic is maybe blocking some dragging related events.

Thanks man, have a nice one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants