Code Monkey home page Code Monkey logo

Comments (15)

gustavjf avatar gustavjf commented on May 19, 2024 1

Android 6.0.1, RN 0.42.0, RN Debugger 0.6.2

I've tried:

  1. Set automatic date + time on my physical device.
  2. requestIdleCallback(() => alert('works!'), { timeout: 1 }) and requestIdleCallback(() => console.log('works!'), { timeout: 1 }), neither are called.
  3. Your workaround above using window object.
  4. Using the polyfill in an if (__DEV__) { ... } statement in my app's entry point.

I still cannot connect to the React dev tools using a physical device (Waiting for React to connect...). I added a console.log() inside if (__DEV__) { ... } just to make sure I am running in a dev environment and it prints correctly. I'm unsure what else to try at this point.

from react-native-debugger.

gustavjf avatar gustavjf commented on May 19, 2024 1

@jhen0409 Thank you, for some reason adb reverse tcp:8097 tcp:8097 works for me now.

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024 1

[email protected] should fixed the problem, please update the package in your react-native project. (Note that it's dependency of react-native)

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024

Are you using Android emulator? Maybe it's same with facebook/react-devtools#476 (comment), try the following code on debug mode:

requestIdleCallback(() => alert('works!'), { timeout: 1 })

If it doesn't called alert, try to reset the date.

$ adb shell "date `date +%m%d%H%M%Y.%S`"

or reset the Android emulator.

from react-native-debugger.

someone235 avatar someone235 commented on May 19, 2024

I'm using a real device

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024

@someone235 same, but you may not have permission to use adb for set time, open the network and sync time in the setting instead.

It's limitation in debug mode for RN, you need to keep the same device and computer time. (It only warn in more than 60 seconds.)

If it still not work and requestIdleCallback also, it may be another problem, could you provide more information? (RN version, Android version...)

from react-native-debugger.

someone235 avatar someone235 commented on May 19, 2024

requestIdleCallback callback is not called.
I have Android 6.0.1 and RN 0.39.2.
Do you know how can I do the time sync? I'm not familiar with the subject.

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024

requestIdleCallback callback is not called.

Looks like it's same problem. :)

Do you know how can I do the time sync? I'm not familiar with the subject.

It's just date & time setting in Android (it should usually be automatic), if it's automatic, you can just make sure the device and computer on the same network.

If you still have this problem, there is a temporary solution here:

// Not recommended
if (__DEV__) {
  window.requestIdleCallback = null
  window.cancelIdleCallback = null
}
// Make sure it before call at `import { ... } from 'react-native'`

Or use external polyfill instead. (Like: react-devtools/agent/Bridge.js#L21-L22)

from react-native-debugger.

someone235 avatar someone235 commented on May 19, 2024

It did the trick, thank you

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024

@gustavjf if you got Waiting for React to connect..., it mean you haven't connect to react inspector server, you can read this section to solve your problem first.

Also, I'm try to fix the problem of requestIdleCallback with facebook/react-native#13116, if anyone still stuck Connecting to React…, just waiting for upstream or use the patch.

from react-native-debugger.

strayer avatar strayer commented on May 19, 2024

I'm having this issue too with the Android emulator and simply can't resolve it… Time on the emulator and my Mac are equal, adb reverse doesn't change anything, window.requestIdleCallback(() => alert("works!"), { timeout: 1 }); apparently isn't called (can't see any alert) and putting the if (__DEV__) … stuff before import "react-native" also doesn't change anything. Same for a real device (although I need to do adb reverse then because the devtools won't even try to connect – but at least that means SOMETHING is working).

This is the right place, yes?

import React, {Component} from "react";
if (__DEV__) {
    window.requestIdleCallback = null;
    window.cancelIdleCallback = null;
}
import {AppRegistry, AsyncStorage} from "react-native";

Edit: Small update: It works fine with the iOS simulator, so this is really only happening on Android. Interesting!

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024

@strayer are you using RN ^0.43? Due to this change (It's no longer exported function), you need put the code before connectToDevTools, I'll update readme.
(node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js)

Also, facebook/react-native#13116 looks ready but have some ship problem, if it goes well it should be at RN 0.45.

from react-native-debugger.

irrigator avatar irrigator commented on May 19, 2024

@jhen0409 I'm using 0.43 and I added the code before connectToDevTools to enable the react dev tools. However, the connecting only works after I Stop Remote JS Debugging. That's weird.

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024

My fault, it should be const {connectToDevTools} = require('react-devtools-core'); before:

if (__DEV__) {
  const AppState = require('AppState');
  const {PlatformConstants} = require('NativeModules');
  // Put the code here
  const {connectToDevTools} = require('react-devtools-core');
  ......
}

However, the connecting only works after I Stop Remote JS Debugging. That's weird.

The requestIdleCallback problem is only cause on Debug JS Remotelymode.

from react-native-debugger.

jhen0409 avatar jhen0409 commented on May 19, 2024

Fixed in facebook/react-devtools#749, please waiting for the new version of the react-devtools-core package.

from react-native-debugger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.