File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
ruby/hyper-component/lib/hyperstack/internal/component Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -27,16 +27,18 @@ def self.import_native_component(opal_class, native_class)
27
27
@@component_classes [ opal_class ] = native_class
28
28
end
29
29
30
+ # patched
31
+ # https://github.com/hyperstack-org/hyperstack/issues/305
30
32
def self . eval_native_react_component ( name )
31
33
component = `eval(name)`
32
34
raise "#{ name } is not defined" if `#{ component } === undefined`
33
-
34
- component = `component.default` if `component.__esModule`
35
+ component = `component.default` if `component.__esModule && component.default`
35
36
is_component_class = `#{ component } .prototype !== undefined` &&
36
- ( `!!#{ component } .prototype.isReactComponent` ||
37
- `!!#{ component } .prototype.render` )
37
+ ( `!!#{ component } .prototype.isReactComponent` ||
38
+ `!!#{ component } .prototype.render` )
39
+ is_memo = `#{ component } .type != undefined` && `typeof #{ component } .type.render === "function"`
38
40
has_render_method = `typeof #{ component } .render === "function"`
39
- unless is_component_class || stateless? ( component ) || has_render_method
41
+ unless is_component_class || stateless? ( component ) || has_render_method || is_memo
40
42
raise 'does not appear to be a native react component'
41
43
end
42
44
component
You can’t perform that action at this time.
0 commit comments