-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
No component found for view with name 'RCTVirtualText' #13925
Comments
I'm getting the same error. react-native/Libraries/Text/Text.js Line 391 in 88a6398
|
getting the same error but kinda randomly |
I'm getting this error only when I am using https://github.com/CharlesMangwa/react-native-simple-markdown |
Any fixes so far? I am getting it when I do a search on a flatlist. |
Commented the following in node_modules/react-native/React/Modules/RCTUIManager.m on line 1011 and inserted a return. Things are moving but this needs a fix for sure. RCTComponentData *componentData = _componentDataByName[viewName]; |
@nickkapoor thatst not a solution. The Solution
No longer you'll get that error. If you need you can revert your changes in Text.js. |
Indeed it worked when I put the return. I will undo it and save and re run the packager. Thanks for the guidance. |
Crashes for me even in simple case , like:
|
Your solution works but that is so weird. Can you explain why it fixes the crash, please? |
@sunkibaek Now you can revert your changes from |
Same here after updated on 0.44 |
@shahen94 Thanks for the explanation. I've used your tip to fix it on simulator but on device (reelease mode) it shows nothing. |
http://blog.csdn.net/jiangbo_phd/article/details/71482363 - this helped. npm uninstall react-native-windows |
I have a component that relies on react-native-windows. node_modules/react-native-windows/Libraries/Components/Button.windows.js' So removing react-native-windows does not work. As a side effect of this issue, I am not seeing Text display on the device but shows up on the simulator similar to the issue @nixoz mentioned. |
@nickkapoor mate, i'm afraid it is... `May 18 23:06:46 nimbp PhiMobile[76266] : Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
Catching this one if do one small test:
proof #2. var _jsxFileName = '/Users/.../node_modules/react-native-windows/Libraries/Text/Text.windows.js';
var ColorPropType = require(401 ); // 401 = ColorPropType
var EdgeInsetsPropType = require(585 ); // 585 = EdgeInsetsPropType
var NativeMethodsMixin = require(403 ); // 403 = NativeMethodsMixin
var Platform = require(372 ); // 372 = Platform
var React = require(569 ); // 569 = React
var ReactNativeViewAttributes = require(583 ); // 583 = ReactNativeViewAttributes
var StyleSheetPropType = require(590 ); // 590 = StyleSheetPropType
var TextStylePropTypes = require(578 ); // 578 = TextStylePropTypes
var Touchable = require(623 ); // 623 = Touchable
.....
some more contents
.....
module.exports = Text;
}, 622, null, "Text"); So, all react components using this guy... Here is no native module for component RCTVirtualText on iOS, so react-native original Text.js have this piece of code: var RCTText = createReactNativeComponentClass(viewConfig);
var RCTVirtualText = RCTText;
if (Platform.OS === 'android') {
RCTVirtualText = createReactNativeComponentClass({
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
}),
uiViewClassName: 'RCTVirtualText',
});
} if you will check Text.windows.js you will see: var RCTText = createReactNativeComponentClass(viewConfig);
var RCTVirtualText = createReactNativeComponentClass({
validAttributes: merge(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
}),
uiViewClassName: 'RCTVirtualText',
}); this is where the exception is coming from... so basically the reason - react-native-implementation.js instead of react-native's own modules requiring modules with the same name from react-native-windows. |
Thanks @nixoz So I am a bit confused now. Are you suggesting that the react-native-windows is taking precedence in rendering the text? And if so, why does the behavior vary between the simulator and the device. To give a proper context, I am seeing this issue creep in for 0.44 RN. I am using the gifted chat, which uses ParsedText. The text displays correctly in the simulator but does not display correctly on the phone. So I am thinking this issue with ParsedText component is showing similar issues that you had mentioned between the device and the simulator. I am at a standstill on this and apparently some component has precedence in rendering text. It seems the precedence varies between the device and the simulator. |
@nickkapoor - It is clearly just packaging/conflict issue between react-native and react-native-windows packages. Why text is not rendered? render () {
var a = ['aaa'].map(i => <Text>{i}</Text>)
return <Text>{a}</Text>
} so the output will be:
internally it's represented as:
on iOS platform RCTText & RCTVirtualText are the same (check react-native's Text.js) var RCTText = createReactNativeComponentClass(viewConfig);
var RCTVirtualText = RCTText; but in case of Text.windows.js it is re assigned to RCTVirtualText = createReactNativeComponentClass({
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
}),
uiViewClassName: 'RCTVirtualText',
}); which is absent on iOS, so that is the reason of exception. p.s to be honest now i'm really interested in how the packaging works and why this thing didn't appeared before RN0.44 |
Awesome explanation. Thanks. So are you suggesting I change the following as per your other blog? at the same time, in jest-haste-map's lib/getPlatformExtension.js we have: const SUPPORTED_PLATFORM_EXTS = { |
Additionally why does it work on the simulator and not on the device? |
I guess, when u editing the react-native module file packager picking it up and rewriting the Text module, then packager picking it up from cache. You can run packager with --reset-cache and everything will be broken again - until u edit the file again.... |
You can try to run app with bundle (release) in simulator - will it work? |
In the simulator there is no problem. However on the device it show a blank for text. |
Think you are onto something with the jeste. Apparently the precedence is different on the simulator than on the device; that's possibly the reason for different behavior. Question is how do I enforce the same precedence on the device that seems to be correct on the simulator. I was hoping that the device and simulator would behave the same way. But apparently that is not true. So something in the build order has to be done for one lib to take over the other. |
@nixoz . The file is in /node_modules/react-native/node_modules/jest-haste-map/build/lib/getPlatformExtension.js So I updated this: const SUPPORTED_PLATFORM_EXTS = { AND YES it works on the device too. Many thanks for the guidance. Also I thought others may benefit and you may want to update your docs also (NOTE: the location of the getPlatformExtension.js) |
@nickkapoor thanks! This fixed an issue running Android in Windows.
just leaving the specific error message here in case someone else encounters it. |
I have tried the very weird (but seemingly effective for others) solution above, but no success. Also tried to make a fresh git clone..no luck. Does anyone have an idea how to approach this issue? ps I'm running RN 0.46..if that helps. cheers |
Never mind, it came back. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
Does anyone know if this was fixed in a later version of RN? I'm still running into the same issue in 0.44. |
Description
Updated RN to latest version 0.44. App is crashing on login with the error in the screenshot.
The issue does not occur on Android. I logged out Platform.OS on XCode simulator, and can see that it is logging out
ios
correctly.Additional Information
The text was updated successfully, but these errors were encountered: