Skip to content

Commit 1aff8dc

Browse files
yungsterskoto
authored andcommitted
Revert "Append text string to <Text> error message (facebook#19581)" (facebook#19723)
This reverts commit 1a41a19.
1 parent 07bad98 commit 1aff8dc

File tree

4 files changed

+6
-28
lines changed

4 files changed

+6
-28
lines changed

Diff for: packages/react-native-renderer/src/ReactFabricHostConfig.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ export function createTextInstance(
244244
): TextInstance {
245245
invariant(
246246
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.',
249248
);
250249

251250
const tag = nextReactTag;

Diff for: packages/react-native-renderer/src/ReactNativeHostConfig.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ export function createTextInstance(
146146
): TextInstance {
147147
invariant(
148148
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.',
151150
);
152151

153152
const tag = allocateTag();

Diff for: packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -563,15 +563,7 @@ describe('ReactFabric', () => {
563563
}));
564564

565565
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.',
575567
);
576568

577569
expect(() =>
@@ -581,9 +573,7 @@ describe('ReactFabric', () => {
581573
</Text>,
582574
11,
583575
),
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.');
587577
});
588578

589579
it('should not throw for text inside of an indirect <Text> ancestor', () => {

Diff for: packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,7 @@ describe('ReactNative', () => {
423423
}));
424424

425425
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.',
435427
);
436428

437429
expect(() =>
@@ -441,9 +433,7 @@ describe('ReactNative', () => {
441433
</Text>,
442434
11,
443435
),
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.');
447437
});
448438

449439
it('should not throw for text inside of an indirect <Text> ancestor', () => {

0 commit comments

Comments
 (0)