Expo & ReactNative 调试器如何使状态可见?

问题描述

我有一个使用 Expo/Typescript 设置的 ReactNative 应用。

我已经下载了 ReactNativeDebugger。

我已确保 ReactNativeDebugger (RND) 的版本与 ReactNative 一致。

  • 调试器:0.11.6
  • ReactNative 版本:0.63.2

我已将 RND 的端口更改为与 expos 端口 (19000) https://docs.expo.io/workflow/debugging/#react-native-debugger 一致。

我已在 expo 应用程序中启用远程调试。

并且看起来与运行在Android物理设备上的RND和ReactNativeExpo的连接是连接的:

enter image description here

但是,我看不到任何 redux 状态等...

是否还有其他故障排除步骤可以让我真正能够在 React Native Debugger 中看到 redux 状态?

解决方法

我遗漏了 React Native 端的 Redux Dev Tools 设置部分:

将以下内容添加到允许查看 redux 状态的 createStore 设置

/** https://github.com/zalmoxisus/redux-devtools-extension#13-use-redux-devtools-extension-package-from-npm */
import { composeWithDevTools } from 'redux-devtools-extension';

const store = createStore(combinedReducers,MyPreloadedState,composeWithDevTools(applyMiddleware(thunk)));

来自https://github.com/zalmoxisus/redux-devtools-extension#13-use-redux-devtools-extension-package-from-npm