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

Commit c6b0763

Browse files
committed
add component displayName setter
1 parent 0e4390e commit c6b0763

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/react/api.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ class extends React.Component {
5656
this.__opalInstance = #{type.new(`this`)};
5757
this.__opalInstanceInitializedState = true;
5858
this.__opalInstanceSyncSetState = false;
59+
this.__name = #{type.name}
5960
}
6061
static get displayName() {
61-
return #{type.name};
62+
return this.__name;
63+
}
64+
static set displayName(name) {
65+
this.__name = name;
6266
}
6367
static get defaultProps() {
6468
return #{type.respond_to?(:default_props) ? type.default_props.to_n : `{}`};
@@ -106,11 +110,11 @@ class extends React.Component {
106110
}
107111
}
108112
componentWillUnmount() {
109-
this.__opalInstance.is_mounted = false;
110113
if (#{type.method_defined? :component_will_unmount}) {
111114
this.__opalInstanceSyncSetState = false;
112115
this.__opalInstance.$component_will_unmount();
113116
}
117+
this.__opalInstance.is_mounted = false;
114118
}
115119
componentDidCatch(error, info) {
116120
if (#{type.method_defined? :component_did_catch}) {

0 commit comments

Comments
 (0)