Skip to content

LogBox.ignoreLogs() does not work #55001

Description

@valery-lavrik

Description

I've tried all possible variations of strings and regular expressions sent to the function, but nothing works
for example like this:

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

LogBox.ignoreLogs([
    /Require cycle: src\/Models\/LogBase/,
    /Require cycle: src\/Components\/RTOSelectComp/,
]);

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

My mistake
Image

I debugged a bit in node_modules\react-native\Libraries\LogBox\Data\LogBoxData.js and found that the ignorePatterns. function is always empty. Even if a pattern was previously added to it

Steps to reproduce

It works in any project with react-native 0.83.1


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

LogBox.ignoreLogs([
    /Require cycle: src\/Models\/LogBase/,
    /Require cycle: src\/Components\/RTOSelectComp/,
]);

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

React Native Version

0.83.1

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

info Fetching system and libraries information...
System:
  OS: Windows 11 10.0.26200
  CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-13620H
  Memory: 2.75 GB / 15.71 GB
Binaries:
  Node:
    version: 22.11.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.19
    path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
  npm:
    version: 10.9.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-241.15989.150.2411.11948838
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.11
    path: C:\Program Files\Microsoft\jdk-17.0.11.9-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 20.0.0
    wanted: 20.0.0
  react:
    installed: 19.2.0
    wanted: 19.2.0
  react-native:
    installed: 0.83.1
    wanted: 0.83.1
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

index.tsx:18 Require cycle: src/Models/LogBase.ts -> src/Models/SyncStack/index.tsx -> src/Models/LogBase.ts

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

RtoSearchScreen.tsx:9 Require cycle: src/Components/RTOSelectComp/index.tsx -> src/Screens/RtoTree/RtoSearchScreen.tsx -> src/Components/RTOSelectComp/index.tsx

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

MANDATORY Reproducer

It works in any project with react-native 0.83.1

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions