hyperstack-org / hyperstack-org/hyperstack

add support for importing new react memo component type

オープン
#305 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug compatibility good first issue
主要言語
JavaScript
スター
538
フォーク
41
PR マージ指標
30日以内にマージされた PR はありません

説明

react now has a component type called memo.

Need to detect when importing. For example the Material UI Icon Library is all built using memo type components.

Here is the patch:

```ruby
module Hyperstack
module Internal
module Component
class ReactWrapper
def self.eval_native_react_component(name)
component = `eval(name)`
raise "#{name} is not defined" if `#{component} === undefined`
component = `component.default` if `component.__esModule && component.default`
is_component_class = `#{component}.prototype !== undefined` &&
(`!!#{component}.prototype.isReactComponent` ||
`!!#{component}.prototype.render`)
is_memo = `#{component}.type != undefined` && `typeof #{component}.type.render === "function"`
has_render_method = `typeof #{component}.render === "function"`
unless is_component_class || stateless?(component) || has_render_method || is_memo
raise 'does not appear to be a native react component'
end
component
end
end
end
end
end
```

For now there is no work around, you have to apply the patch.

(Note this patch also incorporates the patch for #231)

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。