0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

react-navigation v2でパフォーマンスが落ちたときにしたこと

Posted at

起きたこと

・ react-navigation を 2.0.1にした => タブの切り替えが重い。。(特にandroid)。。体感1~2secかかるようになった。

結論

・ バグでした。
  - 今すぐ2.1.0にバージョンあげましょう
https://github.com/react-navigation/react-navigation/issues/4412

とはいえ、それ以外にもパフォーマンスを改善するためにしたことがあるので以下記録として。。。

やったこと

・ 可能な限りstateless function を使う
 - listの中はもちろんですが、ボタンやcontainer的に使っているコンポネントも可能な限りstatelessに。
 - 無理な場合で、pureComponentにできるものはPureComponentに

・ listはFlatListを使用。

・ navigationOptionでlazyLoad={true}に変更

・ view コンポネントで不要な要素は消す。必要以上にnestしない

所感

・ stateless function にするのは体感値ベースでもかなり変わります。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?