jscissr/react-polymer

How to use Polymer custom events?

moebiusmania opened this issue · 3 comments

hi,
I have tried this on custom Polymer components inside a React one

reactPolymer.registerEvent('change', 'onChange');

<tabs-clab onChange={this.changeTab} />

my custom components use this.fire('change') method to trigger a custom event, so following your instructions I have tried to bind che custom change event to an onChange callback inside the React components, but I'm getting this error

invariant.js:38 Uncaught Error: EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `ReactPolymerPlugin`. 

Is it possible to use or add custom events with react-polymer? If not, this is something really impossible or I can help in some way?

thanks

Footnote: it works if use an addEventListener inside the componentDidMount callback, but that would require some extra code...

Can you please give me a full test case so that I can reproduce the error? This shouldn't happen.

you can clone this repo https://github.com/moebiusmania/react-web-components , just do a
$ bower install clab-ui-components
inside the public folder and you have recreated the situation that I mentioned

It works if you add import 'react-polymer'; at the top of src/index.js. react-polymer needs to monkey-patch react, and it can't do that once react is loaded.
But there should have been an error message which tells you that, I fixed that in 22ea782.