2
2

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.

expoでreact-native-debuggerを使う(reduxのデバック)

Last updated at Posted at 2019-05-10

はじめに

expoを使ってreact-nativeで開発している際のデバック方法でreact-native-debuggerがあります。実機で動作を確認する際のデバック設定が少し面倒だったためまとめます。reduxのデバックがメインです。

アプリのインストール

まず最初にreact-native-debuggerのアプリをここからインストールします。

node_modulesの編集

次にnode_modules/react-native/Libraries/Core/Devtools/setupDevtools.jsを開いて下さい。スクリーンショット 2019-05-10 18.19.52.png
52行目のhostの部分を編集します。Your IPのところは今繋がっているIPアドレスを入れて下さい。Macの場合はIPアドレスは、システム環境設定→ネットワーク→状況のところの「IPアドレスhogehogeが設定されています。」のところにあります。編集後↓
スクリーンショット 2019-05-10 18.23.01.png

App.jsの編集

App.jsをこんな感じにします。
スクリーンショット 2019-05-10 18.41.34.png
ポイントは

const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

です。最初はこれがなくてうまくいきませんでした。
設定はこれで終わりです。

手順

  •   http://localhost:<port>/debugger-uiを閉じて下さい
  •  react-native-debuggerのアプリを起動して下さい
  •  スマホの方のDebug JS Remotelyを有効にして下さい
  •  REACT_DEBUGGER="unset ELECTRON_RUN_AS_NODE && open -g 'rndebugger://set-debugger-loc?port=19001' ||" npm startでプロジェクトを起動して下さい。

参考、出典など

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?