Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Enable the new LogBox (RN)

Tags:

react-native

I'm trying to enable the new LogBox in React Native (v0.62.0-rc.2), I just have to add a line to the "index.js" file but it doesn't work.

RC2 introduces the new LogBox experience behind a feature flag. To try it out, add the following to your index.js file:

require('react-native').unstable_enableLogBox()

index.js

require('react-native').unstable_enableLogBox();

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

Error output:

TypeError: _$$_REQUIRE(_dependencyMap[1], "react-native").unstable_enableLogBox is not a function.

I'm sure I'm doing something wrong, maybe it's not the right way.

like image 556
andrefedev Avatar asked Oct 17 '25 03:10

andrefedev


1 Answers

you need to do the following:

  1. create a file in the project root title it intro.js
  2. add require('react-native').unstable_enableLogBox(); to intro.js
  3. add import './intro'; at the top of index.js

This worked with me.

like image 181
Abdallah AbuSalah Avatar answered Oct 18 '25 23:10

Abdallah AbuSalah