react-native: react-native inspector not Showing component file name and it's line number
Description
After updating to latest react native 0.71.7, not able to see component file name and with it’s code line number.
React Native Version
0.71.7
Output of npx react-native info
System: OS: macOS 13.3.1 CPU: (10) x64 Apple M1 Pro Memory: 13.20 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9862592 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 11.0.18 - /Library/Java/JavaVirtualMachines/openlogic-openjdk-11.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.7 => 0.71.7 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
Step to reproduce : go to app press D , will see a inspector option. then inspect any element, observe only react native component are showing. we are not able to comment file name and code line number.
please help here.
Snack, code example, screenshot, or link to a repository
no file name and code line is there.i have scroll to it’s edge also no file name with line was present.
please help here
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 2
- Comments: 18
I found a solution to this.
Before I export the component I need to set the displayName
The issue was due to wrapping my components with the observer from mobx.
So in every component I want to be able to inspect I basically add
MyComponent.displayName = "whatever name I want to see in the `inspector"and then
export { MyComponent }Shameless plug: Here’s my YouTube www.youtube.com/@mayowadan
This is from a brand new React Native project. React Native 0.71.12 seems to have this feature missing.
If you can give some hints at what parts of the codebase are responsible for this feature, please reach out.
Yes, facing the after react native upgrade to 0.71.7
after upgrade to 0.71.8. issue still persist.
System: OS: macOS 13.3.1 CPU: (10) x64 Apple M1 Pro Memory: 13.20 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9862592 Xcode: 14.3/14E222b - /usr/bin/xcodebuild Languages: Java: 11.0.18 - /Library/Java/JavaVirtualMachines/openlogic-openjdk-11.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.8 => 0.71.8 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found