lib/react/function_component/resolution.rb in isomorfeus-react-16.6.2 vs lib/react/function_component/resolution.rb in isomorfeus-react-16.6.3
- old
+ new
@@ -43,14 +43,25 @@
component = null;
}
}
if (component) {
var props = null;
-
if (args.length > 0) {
- props = Opal.React.to_native_react_props(args[0]);
+ var last_arg = args[args.length - 1];
+ if (typeof last_arg === 'string' || last_arg instanceof String) {
+ if (args.length === 1) {
+ Opal.React.internal_render(component, null, last_arg, null);
+ } else {
+ props = Opal.React.to_native_react_props(args[0]);
+ Opal.React.internal_render(component, props, last_arg, null);
+ }
+ } else {
+ props = Opal.React.to_native_react_props(args[0]);
+ Opal.React.internal_render(component, props, null, block);
+ }
+ } else {
+ Opal.React.internal_render(component, null, null, block);
}
- Opal.React.internal_render(component, props, block);
} else {
return #{_react_component_resolution_original_method_missing(component_name, *args, block)};
}
}
end
\ No newline at end of file