Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 8e02a7e

Browse files
committed
add support for multiple args passed by components to event handlers
1 parent 60d87d8 commit 8e02a7e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/react/element.rb

+11-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,17 @@ def merge_event_prop!(event_name, &block)
130130
def merge_built_in_event_prop!(prop_name)
131131
@properties.merge!(
132132
prop_name => %x{
133-
function(event){
134-
return #{yield(React::Event.new(`event`))}
133+
function(){
134+
var react_event = arguments[0];
135+
var all_args;
136+
var other_args;
137+
if (arguments.length > 1) {
138+
all_args = Array.prototype.slice.call(arguments);
139+
other_args = all_args.slice(1, arguments.length);
140+
return #{yield(React::Event.new(`react_event`), *(`other_args`))};
141+
} else {
142+
return #{yield(React::Event.new(`react_event`))};
143+
}
135144
}
136145
}
137146
)

0 commit comments

Comments
 (0)