React-Native调试工具
来源:互联网 发布:建筑工程软件有哪些 编辑:程序博客网 时间:2024/05/16 06:35
Redux的调试,除了最基本的打断点进去调试之外,还有一个好用的调试工具reactotron,它能够帮你清楚的记录你所发出的action,以及http请求,可以帮你更好的分析redux的结构。
下面说一下简单的配置
package.json
中的添加
devDependencies: { "reactotron-apisauce": "^1.11.1", "reactotron-react-native": "^1.11.1", "reactotron-redux": "^1.11.2", "reactotron-redux-saga": "^1.11.1"}
- 修改
store.js
文件
import Reactotron from 'reactotron-react-native';import { composeWithDevTools } from 'redux-devtools-extension';import '../ReactotronConfig'; const sagaMiddleware = createSagaMiddleware({ sagaMonitor: Reactotron.createSagaMonitor(), }); const store = Reactotron.createStore( xxReducer, composeWithDevTools(middleware), );
ReactotronConfig.js
文件
import Reactotron, { networking } from 'reactotron-react-native';import { reactotronRedux as reduxPlugin } from 'reactotron-redux';import sagaPlugin from 'reactotron-redux-saga';/* eslint no-console:0 */console.disableYellowBox = true;Reactotron.configure({ name: 'ReactNativeSinooa' }); // controls connection & communication settingsReactotron.useReactNative(); // add all built-in react native pluginsReactotron.use(reduxPlugin());Reactotron.use(sagaPlugin());Reactotron.use(networking());// if we're running in DEV mode, then let's connect!/* eslint no-undef:0 */if (__DEV__) { Reactotron.connect(); Reactotron.clear();}
DOM结构查看
可以查看dom结构的react devtools。
只需要在index.ios.js
和index.android.js
文件中引入import 'react-devtools';
即可。
import 'react-devtools'; // 引入,需要执行`yarn add react-devtools `import { AppRegistry } from 'react-native';import APP from './src/APP';AppRegistry.registerComponent('workflow', () => APP);
然后在
//package.json中添加` "devtools": "react-devtools"`类似下面这样"scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest", "devtools": "react-devtools" },
然后在命令行执行yarn run devtools
即可。
配合ios模拟器可以方便进行查找dom元素。
阅读全文
0 0
- React-Native调试工具
- react-native-debugger调试工具
- React-Native环境配置及调试工具
- React Native调试方法
- React Native调试插件
- React Native调试心得
- React Native调试心得
- 调试 React Native 应用
- React Native的调试
- React Native调试技巧
- React Native调试技巧
- React-native Webstorm调试
- React Native 调试步骤
- React Native调试
- React Native 开发工具
- React Native真机调试
- React Native真机调试
- React native真机调试
- 判断链表成环,且找出环的起点
- 头文件 string.h cstring string 区别
- 哈哈哈
- 打开或关闭 Windows 功能
- 深入理解javaScript原型和闭包(1)--- 一切都是对象
- React-Native调试工具
- 表达式计算(栈)
- [Paper Reading]EFFICIENT VECTOR REPRESENTATION FOR DOCUMENTS THROUGH CORRUPTION
- addrinfo& sockaddr结构解析
- HDOH 2309 ICPC Score Totalizer Software(水题)
- MR--WordCount的MapReduce程序注释
- DTE与DCE
- 单点登录原理与简单实现
- java编程思想-内部类