4

I try to debug an application with Reactotron in a (IOS) React Native project but there is "No Activity" when I run my application.

I work with react-native 0.55.4, reactotron 2.1.0 (same in my package.json)

TimeLine Reactotron

My reactotronConfig.js

index.js file where reactotron is imported

reactotron in my package.json

J.dev
  • 844
  • 3
  • 12
  • 22

6 Answers6

4

You have to do the following:

  1. enter on CLI: adb reverse tcp:9090 tcp:9090
  2. add this to a file (e.g lib/Reactotron.js):
import Reactotron, { asyncStorage } from 'reactotron-react-native';
Reactotron
    .configure() // controls connection & communication settings
    .useReactNative(asyncStorage()) // add all built-in react native plugins
    .connect();
  1. import the File in your app.js:
    if (__DEV__) {
      import('../../lib/Reactotron').then(() => console.log('Reactotron Configured'));
    }

Note: If you wan't to use host Prorperty inside of configure(), be sure to use 127.0.0.1. In my case other IP (even if local like 192.x.x.x) doesn't work.

After that, you connection should work, and you can use Reactotron like described in the Docs.


HINT:

For Linux & Mac, you can add this to package.json (script-section) (adjust the path & call of your reactotron-app to your needs):

"scripts": {
...
    "reactotron": "adb reverse tcp:9090 tcp:9090 && /opt/Reactotron/reactotron-app",
...
}
suther
  • 12,600
  • 4
  • 62
  • 99
4

I did this adb reverse tcp:9090 tcp:9090 that I got from Suther and yarn start --reset-cache and it worked.

Chinedu Ofor
  • 707
  • 9
  • 11
2

First of, you are not assigning the configured Reactotron object to your console.tron value. You need to do something like this:

console.tron = Reactotron.configure({ ...

Looking at your reactotronConfig.js file I notice that you are sending it to localhost. This will only work when running on the simulator (not sure if that is what you are doing).

If you want to run it on a device, you will need to give it your packager's ip address. A neat way of doing that is to use the following code:

import { NativeModules } from 'react-native';

let packagerHostname = "localhost";
if (__DEV__) {
 const scriptURL = NativeModules.SourceCode.scriptURL;
 packagerHostname = scriptURL.split("://")[1].split(":")[0];
}

const reactotron = Reactotron.configure({
  name: "myAPPILOC",
  host: packagerHostname
});

console.tron = Reactotron;
Francois Nadeau
  • 7,023
  • 2
  • 49
  • 58
  • This worked for me on a physical device. However, I did not need `console.tron = Reactotron;`. `console.tron` was not even supported on my React Native project. – neutrino2039 Jul 26 '22 at 11:54
  • `console.tron` is added in the top part of the answer. You will need to add it before you can use it. Glad that the rest worked out for you. – Francois Nadeau Jul 26 '22 at 13:43
0

Please enable debug mode ( Press ⌘+D on iOS simulator, ⌘+M on Android emulator, or shake real devices). Then kill app and restart app.

I hope it's help

Nakul Kundaliya
  • 542
  • 2
  • 12
  • Thanks for your answer, I work on Mac High Sierra from VNC viewer so cmd+D doesn't work for enabling debug mode, I try to find a solution and I back for telling you what will happened :-) – J.dev Sep 17 '18 at 09:57
0

What I can recommend and what has worked for me is to install these version packages:

 "reactotron-react-native": "3.5.0",
    "reactotron-redux": "3.1.0",

Then you will need to configure your store accordingly:

import {createStore, applyMiddleware, compose, combineReducers} from 'redux';

const appReducer = combineReducers({
  ...reducers,
});
const middleware = applyMiddleware(thunkMiddleware);
//react-native-debugger config
// eslint-disable-next-line no-underscore-dangle
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
// const store = Reactotron.createStore(appReducer, composeEnhancers(middleware));
const store = createStore(appReducer, composeEnhancers(middleware, Reactotron.createEnhancer()));

Now of course, the above is my setup but you will need to tweak yours accordingly, the main point being follow the Configuration as documented here: https://github.com/infinitered/reactotron/blob/master/docs/plugin-redux.md

Daniel
  • 14,004
  • 16
  • 96
  • 156
0

Sometimes the reason of the reactotron is waiting for connection is because of the port has been occupied, we can check and kill the process who use it.

`lsof -i:9090'

Saint
  • 1,492
  • 1
  • 11
  • 20