All Projects β†’ blankg β†’ react-native-devtools-spy

blankg / react-native-devtools-spy

Licence: MIT license
Adds a Spy option to the React Native development menu

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to react-native-devtools-spy

umi-plugin-mobx
😍 use mobx-state-tree gracefully in umijs.
Stars: ✭ 33 (+135.71%)
Mutual labels:  mobx
Mung-React
leaning react
Stars: ✭ 13 (-7.14%)
Mutual labels:  mobx
mst-effect
πŸ’« Designed to be used with MobX-State-Tree to create asynchronous actions using RxJS.
Stars: ✭ 19 (+35.71%)
Mutual labels:  mobx
kolaboard
A Real-time chat, collaboration and productivity enhancement application for teams built using React.js, Node.js, Socket.IO, MobX, MongoDB.
Stars: ✭ 23 (+64.29%)
Mutual labels:  mobx
react-native-taopiaopiao
react-native ζž„ε»Ίε…¨ζ ˆζ·˜η₯¨η₯¨
Stars: ✭ 30 (+114.29%)
Mutual labels:  mobx
react-mobx-router
Create React App with React Router 4 and MobX + Internationalization
Stars: ✭ 90 (+542.86%)
Mutual labels:  mobx
stencil-mobx
No description or website provided.
Stars: ✭ 26 (+85.71%)
Mutual labels:  mobx
movue
MobX integration for Vue.js.
Stars: ✭ 57 (+307.14%)
Mutual labels:  mobx
tm-nextjs-starter
React + Nextjs + MobX starter
Stars: ✭ 49 (+250%)
Mutual labels:  mobx
react-mobx-webpack-seed
a boiler plate for React, MobX and Webpack application with tests and coverage.
Stars: ✭ 21 (+50%)
Mutual labels:  mobx
orkan
A content management toolkit for building and managing dynamic React applications with ease.
Stars: ✭ 25 (+78.57%)
Mutual labels:  mobx
veact
Mutable state enhancer library for React based on @vuejs
Stars: ✭ 62 (+342.86%)
Mutual labels:  mobx
mobx-react-docz
DEPRECATED Documentation site for MobX in React
Stars: ✭ 43 (+207.14%)
Mutual labels:  mobx
todo-list
A simple todo list application with React and mobx and antd
Stars: ✭ 25 (+78.57%)
Mutual labels:  mobx
ngx-mobx
Mobx decorators for Angular Applications
Stars: ✭ 14 (+0%)
Mutual labels:  mobx
react-mobx-local-state-example
React MobX (for Local State) Example
Stars: ✭ 27 (+92.86%)
Mutual labels:  mobx
plex-music
Web/Desktop app for streaming music from your Plex Media Server
Stars: ✭ 42 (+200%)
Mutual labels:  mobx
NObservable
MobX like observable state management library with Blazor support
Stars: ✭ 66 (+371.43%)
Mutual labels:  mobx
mobx-react-tetris
No description or website provided.
Stars: ✭ 30 (+114.29%)
Mutual labels:  mobx
natsuha-weather
Natsuha Weather for WeChat Mini Program.
Stars: ✭ 33 (+135.71%)
Mutual labels:  mobx

npm version

react-native-devtools-spy

Add this package to your react native project to get an extra "Spy" development menu option. Clicking the "Spy" button will turn on extra logs:

  1. All MessageQueue messages (messages going over the javascript <-> native bridge).
  2. All MobX events.

Getting started

$ npm install react-native-devtools-spy --save

Mostly automatic installation

$ react-native link react-native-devtools-spy

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.devtools.spy.SpyOptionsHandler; to the imports at the top of the file
  • Add import android.os.Bundle; to the imports at the top of the file
  • Add the following lines to the onCreate method:
protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      if (BuildConfig.DEBUG) {
          getReactInstanceManager().getDevSupportManager()
                  .addCustomDevOption("Spy",
                          new SpyOptionsHandler(
                                  getReactInstanceManager()));
      }
  } 
  1. Append the following lines to android/settings.gradle:
    include ':react-native-devtools-spy'
    project(':react-native-devtools-spy').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-devtools-spy/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-devtools-spy')
    

iOS

  1. In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
  2. Go to node_modules ➜ react-native-devtools-spy and add RNDevToolsSpy.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNDevToolsSpy.a to your project's Build Phases ➜ Link Binary With Libraries
  4. Run your project (Cmd+R)<

Usage

Add the DevToolsSpy component to your view hierarchy:

import DevToolsSpy from 'react-native-devtools-spy';
...
render() {
    return (
      <View>
          {__DEV__ ? <DevToolsSpy /> : null}
      </View>
    );
  }

Run your application and open the development menu (shake/cmd+d/cmd+m). Click on the "Spy" menu item. Toggle the "Message queue" button. In the console logs you will see the extra logs of all messages going over the native <-> javascript bridge, as such:

N->JS : RCTEventEmitter.receiveTouches(["topTouchStart",[{"target":9,"locationX":62.5,"pageY":389,"force":0,"locationY":22,"pageX":197,"identifier":1,"timestamp":190140621.128411}],[0]])
JS->N : UIManager.measure([12,33391])
JS->N : NativeAnimatedModule.createAnimatedNode([3,{"type":"value","value":1,"offset":0}])
JS->N : NativeAnimatedModule.createAnimatedNode([2,{"type":"style","style":{"opacity":3}}])

If you are using MobX inyour project also toggle the "MobX" button to log all MobX events, as such:

[MobX] {type: "update", object: {…}, oldValue: 1517169620887, name: "text1", newValue: 1517169740502, β€¦}
[MobX] {object: Reaction, type: "scheduled-reaction"}
[MobX] {spyReportEnd: true}
[MobX] {object: Reaction, type: "reaction", fn: Ζ’, spyReportStart: true}
[MobX] {time: 3, spyReportEnd: true}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].