LogBox Error at the beginning of the application
See original GitHub issueEnvironment
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Memory: 41.38 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 21, 22, 23, 24, 25, 26, 27, 28
Build Tools: 19.1.0, 23.0.1, 27.0.2, 27.0.3, 28.0.3, 29.0.0
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.1 AI-173.4697961
Xcode: 11.2.1/11B53 - /usr/bin/xcodebuild
npmPackages:
react: 16.11.0 => 16.11.0
react-native: 0.62.1 => 0.62.1
npmGlobalPackages:
react-native: 0.61.5
Upgrading version
0.62.1
Problem
LogBox must be enabled before AppContainer is required so that it can properly wrap the console methods.
Solution
As usual we separate the code inside the “src” folder. In the index.js file at the root of the project, we call it as follows:
require('react-native').unstable_enableLogBox()
...
import { App } from './src'
For me this generated the above error. To resolve, change the “import” to “require” Example:
require('react-native').unstable_enableLogBox()
...
const { App } = require('./src')
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:6
Top Results From Across the Web
How to Enable the new LogBox (RN) - react native
Error: LogBox must be enabled before AppContainer is required so that it can properly wrap the console methods. Please enable LogBox earlier in ......
Read more >Issues with LogBox & Error Displaying - Expo SDK - Forums
If I haven't been working on the project for a few days, I don't even know what file to start with besides app.js...
Read more >Intro to LogBox, React Native's new and improved debugging ...
LogBox addresses complaints that errors and warnings in React Native were too verbose, poorly formatted, and unactionable. The new solution is:
Read more >Announcing React Native 0.63 with LogBox
Code Frames: Every error and warning now includes a code frame that shows the source code of the log right inside the app,...
Read more >Logging in React Native: All you Need to know! - Biz4Solutions
Hermes improves an app's start-up time by ahead-of-time JS ... Whenever there's a Syntax error, a full-screen LogBox error appears.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That didn’t work for me.
What worked for me was creating a
before.js
file only containing therequire('react-native').unstable_enableLogBox();
line. And thenimport './before'
; at the very top of index.jsAnd I didn’t change the App import into a require.
Same problem here, the logs are saying that require(‘react-native’).unstable_enableLogBox() is now deprecated once it is included by default. Is there something else that worked for you guys?