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.

'ReactNative.Component' warning needs to give source filename and line number

See original GitHub issue

When updating a React Native project from a pre-0.25.x version to a post-0.25.x version

This:

Seems you're trying to access 'ReactNative.Component' from the 'react-native' package. Perhaps you meant to access 'React.Component' from the 'react' package instead?

For example, instead of:

  import React, { Component, View } from 'react-native';

You should now do:

  import React, { Component } from 'react';
  import { View } from 'react-native';

Check the release notes on how to upgrade your code - https://github.com/facebook/react-native/releases/tag/v0.25.1

is a pretty common error message. It’s also completely useless. It’s not a big problem when hunting through one’s own code for deprecated references. The problem happens if this is being triggered by something in an imported npm module. Then it becomes a game of auditing other people’s code, which sort of defeats the purpose of pulling in npm modules completely. A filename and line number would at least give some clue as to which module needs to be upgraded.

Every error in React Native gives a filename and line number, (And they’re almost always spot-on, which is unheard of in JavaScript) except this one. Why make an exception here?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:27
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

23reactions
lynndylanhurleycommented, Jun 26, 2016

This error is killing me.

2reactions
HyperSimoncommented, Apr 18, 2017

Is everyone still getting this issue? None of the above workarounds are working.

Here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to get the line number of an error in React ...
Answer is NO for most cases. The screen you shared here is of very little use for knowing where error is coming from....
Read more >
React Native Error Handling Best Practices
A source map will help you when handling and debugging a React Native error because it will show you the exact line in...
Read more >
Lists and Keys
First, let's review how you transform lists in JavaScript. Given the code below, we use the map() function to take an array of...
Read more >
Google JavaScript Style Guide
1 Introduction. This document serves as the complete definition of Google's coding standards for source code in the JavaScript programming language.
Read more >
rollup.js
You can provide an optional Rollup configuration file to simplify command line usage and enable advanced Rollup functionality. Configuration Files. Rollup ...
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