Help us understand the problem. What is going on with this article?

react-navigation3系で画面遷移の実装をしていたが、今までのやり方は使えなそう。

More than 1 year has passed since last update.

これは

react-nativeやreact-navigationなどのバージョン更新が激しく、今まで使えていた方法での画面遷移ができなそうです。

そこで、react-navigation 3.x系の使い方を書いておきます。

日本語の文献がなさすぎて辛いので、誰かのためになれば幸いです。

バージョン

package.json

"dependencies": {
    "expo": "^31.0.2",
    "install": "^0.12.2",
    "npm": "^6.4.1",
    "react": "16.5.0",
    "react-dom": "^16.6.3",
    "react-native": "^0.57.7",
    "react-navigation": "^3.0.1"
  },

今までと今後のStackNavigatorの使い方

今までの書き方

App.js
import StackNavigator from 'react-navigation'

const app = StackNavigator(
//いろいろ
);

export default app;

今後

containerで囲んでくれというエラーがたくさん出るので、React Navigation公式documentを参照した。

App.js
import { createStackNavigator, createAppContainer } from 'react-navigation';

const app = createStackNavigator({
//いろいろ
});

export default createAppContainerapp;

どうやら、createAppContainerで囲まないと画面遷移の実装ができなくなったようです。

最後に

日本ではRNの利用例が少ないので、皆さんとコミュニティを大きくしていきたいです!

参考になったらいいねを押してください!

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away