Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogBox Error at the beginning of the application #39

Open
mateusmirandaalmeida opened this issue Apr 6, 2020 · 6 comments
Open

LogBox Error at the beginning of the application #39

mateusmirandaalmeida opened this issue Apr 6, 2020 · 6 comments

Comments

@mateusmirandaalmeida
Copy link

Environment

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')
@Tejpbit
Copy link

Tejpbit commented Jun 5, 2020

That didn't work for me.

What worked for me was creating a before.js file only containing the require('react-native').unstable_enableLogBox(); line.
And then import './before'; at the very top of index.js

And I didn't change the App import into a require.

@naquilini
Copy link

I'm having the same issue when upgrading from react-native 0.61.4 to 0.63.4.
I'm using xCode 12.2.

I tried the solution proposed by @Tejpbit but no success unfortunately.

Is there something else I can try?

Thanks

@trizotti
Copy link

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?

@jakubgrzelak
Copy link

??

@selugbem
Copy link

Also having the deprecated note showing...any solution?

@AshlandWest
Copy link

I ran into this error on React Native. For me, the issue was due to my code throwing an error before LogBox had a chance to start.
Check your React Native debugger and see if there are any errors thrown before the error you're seeing in XCode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants