question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[0.65] [iOS] Redbox displayed as well as LogBox

See original GitHub issue

Description

In 0.65 on iOS, RedBox is displayed as well as LogBox when using console.error or throwing an Error.

React Native version:

System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 84.11 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.0/bin/yarn
    npm: 7.5.4 - ~/.nvm/versions/node/v14.15.0/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6241897
    Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.6 - /usr/local/opt/openjdk@11/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.65.1 => 0.65.1
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. npx react-native init Test --version 0.65.1
  2. Open up App.js and add the following to App component:
    const App: () => Node = () => {
       const isDarkMode = useColorScheme() === 'dark';
       console.error('hello'); // <-- Add this here
       const backgroundStyle = {
         backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
       };
    
  3. run yarn start and yarn ios

Expected Results

I expect to only see the error in LogBox at the bottom of the screen as in 0.64.2: Screenshot 2021-08-27 at 16 59 06

Actual Results

I get the Error in Redbox as well (Note that this is only an issue on iOS):

Screenshot 2021-08-27 at 16 58 42

This also happens when throwing an Error, however it isn’t as much of an issue as LogBox is displayed in full screen in this case anyway.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
liamjonescommented, Nov 24, 2021

Oh, I forgot to post in here.

I believe I’ve found the original cause for this issue and I’ve raised a PR for the fix: https://github.com/facebook/react-native/pull/32641

If you want to fix it locally, in advance of the PR being released, it’s a one-line change you could use patch-package to apply.

3reactions
chrisgreen1993commented, Sep 23, 2021

@apamphilon By the moment we put this so we can go ahead with the upgrade don’t know the full impact of put this //

https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/Libraries/Core/ExceptionsManager.js#L97

// @ts-ignore Disable error screen from console.error as we use it. console.reportErrorsAsExceptions = false;

@anthowm This could work as a workaround for now although one thing to note with this is that it also disables LogBox for console.errors.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing React Native 0.63 with LogBox
LogBox is a completely redesigned redbox, yellowbox, and logging experience in React Native. In 0.62 we introduced LogBox as an opt-in.
Read more >
Blog · React Native
LogBox is a completely redesigned redbox, yellowbox, and logging experience in React Native. In 0.62 we introduced LogBox as an opt-in.
Read more >
How do you hide the warnings in React Native iOS simulator?
According to React Native Documentation, you can hide warning messages by setting disableYellowBox to true like this: console.disableYellowBox = true; ...
Read more >
REDBOX: Rent, Stream & Buy 12+ - App Store
Download REDBOX: Rent, Stream & Buy and enjoy it on your iPhone, iPad, ... you could not see what was on the screen...
Read more >
@react-native-community/eslint-plugin | Yarn - Yarn
... ReactHorizontalScrollViewManager (deec1db9fd) and update ScrollView.js (a54cfb9e57) and reach parity with iOS (04184ef851) by @mdvacca; Show Redbox for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found