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)
2727 @@component_classes [ opal_class ] = native_class
2828 end
2929
30+ # patched
31+ # https://github.com/hyperstack-org/hyperstack/issues/305
3032 def self . eval_native_react_component ( name )
3133 component = `eval(name)`
3234 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`
3536 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"`
3840 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
4042 raise 'does not appear to be a native react component'
4143 end
4244 component
You can’t perform that action at this time.
0 commit comments