LoginSignup
2
2

More than 5 years have passed since last update.

React-navigation v1 => v2へのアップデート

Posted at

react-navigation のアップデートをしたのでその記録

XXXNavigator() を createXXXNavigator に変更

image.png
image.png

TabNavigatorはcreateBottomTabNavigator とcreateMaterialTopTabNavigatorになっている模様
createTabNavigatorも使えるが今後廃止予定 (yellowboxにエラーが出る)

積み重ねたい画面ではnavigatin.navigate()ではなくnavigation.push()を使うように変更

The following actions are supported:

Reset - Replace current state with a new state
Replace - Replace a route at a given key with another route
Push - Add a route on the top of the stack, and navigate forward to it
Pop - Navigate back to previous routes
PopToTop - Navigate to the top route of the stack, dismissing all other routes

navigateも使えますが、挙動が変わっているの注意。

複数のナビゲーションは明確に使えなくなったのでその修正

Drawer関係の修正

結構かわったっぽい(自分は使用していないので未確認)

所感

ReplaceやPopなど便利なapiが追加されたのは嬉しい。navigate時の連打対応なども簡単に。

が、ちょっともっさりした感もある?? (特にandroidで顕著)
githubでもちょこちょこissueが上がっているが、、どうなるやら

appendix

2
2
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
2
2