Skip to content

Commit

Permalink
Revert "Append text string to <Text> error message (#19581)" (#19723)
Browse files Browse the repository at this point in the history
This reverts commit 1a41a19.
  • Loading branch information
yungsters committed Aug 28, 2020
1 parent ddd1faa commit 380dc95
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
3 changes: 1 addition & 2 deletions packages/react-native-renderer/src/ReactFabricHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ export function createTextInstance(
): TextInstance {
invariant(
hostContext.isInAParentText,
'Text string must be rendered within a <Text> component.\n\nText: %s',
text.length > 100 ? text.substr(0, 88) + ' (truncated)' : text,
'Text strings must be rendered within a <Text> component.',
);

const tag = nextReactTag;
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native-renderer/src/ReactNativeHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ export function createTextInstance(
): TextInstance {
invariant(
hostContext.isInAParentText,
'Text string must be rendered within a <Text> component.\n\nText: %s',
text.length > 100 ? text.substr(0, 88) + ' (truncated)' : text,
'Text strings must be rendered within a <Text> component.',
);

const tag = allocateTag();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,15 +563,7 @@ describe('ReactFabric', () => {
}));

expect(() => ReactFabric.render(<View>this should warn</View>, 11)).toThrow(
'Text string must be rendered within a <Text> component.\n\nText: this should warn',
);

expect(() =>
ReactFabric.render(<View>{'x'.repeat(200)}</View>, 11),
).toThrow(
`Text string must be rendered within a <Text> component.\n\nText: ${'x'.repeat(
88,
)} (truncated)`,
'Text strings must be rendered within a <Text> component.',
);

expect(() =>
Expand All @@ -581,9 +573,7 @@ describe('ReactFabric', () => {
</Text>,
11,
),
).toThrow(
'Text string must be rendered within a <Text> component.\n\nText: hi hello hi',
);
).toThrow('Text strings must be rendered within a <Text> component.');
});

it('should not throw for text inside of an indirect <Text> ancestor', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,7 @@ describe('ReactNative', () => {
}));

expect(() => ReactNative.render(<View>this should warn</View>, 11)).toThrow(
'Text string must be rendered within a <Text> component.\n\nText: this should warn',
);

expect(() =>
ReactNative.render(<View>{'x'.repeat(200)}</View>, 11),
).toThrow(
`Text string must be rendered within a <Text> component.\n\nText: ${'x'.repeat(
88,
)} (truncated)`,
'Text strings must be rendered within a <Text> component.',
);

expect(() =>
Expand All @@ -441,9 +433,7 @@ describe('ReactNative', () => {
</Text>,
11,
),
).toThrow(
'Text string must be rendered within a <Text> component.\n\nText: hi hello hi',
);
).toThrow('Text strings must be rendered within a <Text> component.');
});

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

0 comments on commit 380dc95

Please sign in to comment.