Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions lib/src/react/react_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,27 @@ class ReactElement {}
class Props {
external bool get disabled;
external String get className;
external String get value;
external Function get onClick;
external Function get onChange;

external factory Props({String className, bool disabled, Function onClick,
Function onChange});
external factory Props({String className, bool disabled, String value,
Function onClick, Function onChange});
}

Props _props({String className, bool disabled, void onClick(EventHandler<SyntheticMouseEvent> event),
void onChange(EventHandler<SyntheticEvent> event)}) {
return new Props(className: className, disabled: disabled, onClick: _wrapEventHandler(onClick),
Props _props({String className, bool disabled, String value,
EventHandler<SyntheticMouseEvent> onClick,
EventHandler<SyntheticEvent> onChange}) {
return new Props(className: className, disabled: disabled, value: value,
onClick: _wrapEventHandler(onClick),
onChange: allowInterop(onChange));
}

ReactElement createElement(typeOrClass, [Map props, children]) {
var interopProps = new Props();
if (props != null) {
interopProps = _props(className: props["className"], onClick: props["onClick"],
onChange: props["onChange"]);
interopProps = _props(className: props["className"], value: props["value"],
onClick: props["onClick"], onChange: props["onChange"]);
}
return internal.createElement(typeOrClass, interopProps, children);
}