Revert "Append text string to <Text> error message (#19581)" (#19723)
This reverts commit 1a41a196bcb30d456d1692c4a40cb8273fa2cb92.
Timothy Yung committed
Aug 28, 2020 at 13:46 UTC
380dc95de826508ef4c637f2a27f2501b8b8e693
4 files changed
+6
-28
packages/react-native-renderer/src/ReactFabricHostConfig.js
+1
-2
@@ -244,8 +244,7 @@ export function createTextInstance(
244
): TextInstance {
245
invariant(
246
hostContext.isInAParentText,
247
- 'Text string must be rendered within a <Text> component.\n\nText: %s',
248
- text.length > 100 ? text.substr(0, 88) + ' (truncated)' : text,
247
+ 'Text strings must be rendered within a <Text> component.',
248
);
249
250
const tag = nextReactTag;
packages/react-native-renderer/src/ReactNativeHostConfig.js
+1
-2
@@ -146,8 +146,7 @@ export function createTextInstance(
146
): TextInstance {
147
invariant(
148
hostContext.isInAParentText,
149
- 'Text string must be rendered within a <Text> component.\n\nText: %s',
150
- text.length > 100 ? text.substr(0, 88) + ' (truncated)' : text,
149
+ 'Text strings must be rendered within a <Text> component.',
150
);
151
152
const tag = allocateTag();
packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js
+2
-12
@@ -563,15 +563,7 @@ describe('ReactFabric', () => {
563
}));
564
565
expect(() => ReactFabric.render(<View>this should warn</View>, 11)).toThrow(
566
- 'Text string must be rendered within a <Text> component.\n\nText: this should warn',
567
- );
568
-
569
- expect(() =>
570
- ReactFabric.render(<View>{'x'.repeat(200)}</View>, 11),
571
- ).toThrow(
572
- `Text string must be rendered within a <Text> component.\n\nText: ${'x'.repeat(
573
- 88,
574
- )} (truncated)`,
566
+ 'Text strings must be rendered within a <Text> component.',
567
);
568
569
expect(() =>
@@ -581,9 +573,7 @@ describe('ReactFabric', () => {
573
</Text>,
574
11,
575
),
584
- ).toThrow(
585
- 'Text string must be rendered within a <Text> component.\n\nText: hi hello hi',
586
- );
576
+ ).toThrow('Text strings must be rendered within a <Text> component.');
577
});
578
579
it('should not throw for text inside of an indirect <Text> ancestor', () => {
packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js
+2
-12
@@ -423,15 +423,7 @@ describe('ReactNative', () => {
423
}));
424
425
expect(() => ReactNative.render(<View>this should warn</View>, 11)).toThrow(
426
- 'Text string must be rendered within a <Text> component.\n\nText: this should warn',
427
- );
428
-
429
- expect(() =>
430
- ReactNative.render(<View>{'x'.repeat(200)}</View>, 11),
431
- ).toThrow(
432
- `Text string must be rendered within a <Text> component.\n\nText: ${'x'.repeat(
433
- 88,
434
- )} (truncated)`,
426
+ 'Text strings must be rendered within a <Text> component.',
427
);
428
429
expect(() =>
@@ -441,9 +433,7 @@ describe('ReactNative', () => {
433
</Text>,
434
11,
435
),
444
- ).toThrow(
445
- 'Text string must be rendered within a <Text> component.\n\nText: hi hello hi',
446
- );
436
+ ).toThrow('Text strings must be rendered within a <Text> component.');
437
});
438
439
it('should not throw for text inside of an indirect <Text> ancestor', () => {