react-R/reactR

event handling

Closed this issue · 1 comments

Currently, there is no way to pass events from a react htmlwidget to Shiny. We have very briefly discussed the following approaches. I'd like to target this for next release.

Prop

One approach (shown in pull) would be to use a special prop that would get evaluated in react-tools.js. This is easy but only allows a single event, could interfere with a real prop (unlikely but possible), and requires a one argument function.

Wrapper Function in R

Another approach would add a function in R, such as withShinyEvent( reactwidget, ... ), that attaches an event handler to a widget.

Custom JavaScript from Author

@pvictor demonstrates how a widget author might write a custom component in JavaScript in reactcolors. This provides fairly unlimited flexibility but requires a higher level of author skill.

Are there other approaches not considered?

should be solved by #22