2

I am using Flipper to check the performance issue for a React Native project. Whenever I am selecting the React DevTools option, I am getting error on the iOS simulator. Attached screenshot for reference.enter image description here I want to check the load time for components.

My React Native version is 0.63.4. I am unsure if I need to install package for dev tools.

I found following error in Flipper which says Failed to find globally installed React DevTools

enter image description here

Help me.

Sujit
  • 610
  • 7
  • 26

2 Answers2

1

The github issue has some more movement: https://github.com/facebook/flipper/issues/4046

Steps to upgrade the Flipper built in reactDevTools:

  1. npx i -g react-devtools react-devtools-inline
  2. Then a use global devtools toggle should appear in the Flipper -> React DevTools area and the failed to find globally installed React devTools should also be gone.

Credit goes to answers in the linked github issue.

If like me you are also running into a situation where the app crashes with createElement error : ERROR TypeError: Cannot read property 'createElement' of undefined, js engine: hermes then => turn off Highlight on component update in Flipper: https://github.com/facebook/flipper/issues/4131

Lastly RN apps start crashing on boot up when run on their own after using Flipper, this is a known issue: https://github.com/facebook/flipper/issues/3284

Yonz
  • 120
  • 6
  • For those where the createElement error is not being created by Flipper, there are a flood of information on imports and the like. Feel free to set interop for a quick fix: tsconfig.json` "esModuleInterop": true,` under `compilorOptions` – Yonz Sep 22 '22 at 02:39
0

It is failing because you are trying to use an object provided by the browser. React Native is running Javascript code in a different environment than the browser and this environment don't have a window, thus window is an undefined object.

Usually, some elements of the window are pollyfield to empty values, to avoid some packages to break.

Somewhere in your code, you are trying to create an element using window.document.createElement(), or document.createElement(), which is unavailable.

Try to remove that part and test again.

Jonatan Kruszewski
  • 1,027
  • 3
  • 23
  • Explicitly, I am not using createElement but may be any third party package. I will investigate more as per your suggestion. Thanks Jonatan. – Sujit Sep 01 '22 at 07:01