Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/react-native-renderer/src/ReactFabricHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import type {
import {mountSafeCallback_NOT_REALLY_SAFE} from './NativeMethodsMixinUtils';
import {create, diff} from './ReactNativeAttributePayload';

import invariant from 'shared/invariant';

import {dispatchEvent} from './ReactFabricEventEmitter';

import {
Expand Down Expand Up @@ -251,10 +249,11 @@ export function createTextInstance(
hostContext: HostContext,
internalInstanceHandle: Object,
): TextInstance {
invariant(
hostContext.isInAParentText,
'Text strings must be rendered within a <Text> component.',
);
if (__DEV__) {
if (!hostContext.isInAParentText) {
console.error('Text strings must be rendered within a <Text> component.');
}
}

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

it('should throw for text not inside of a <Text> ancestor', () => {
it('should console error for text not inside of a <Text> ancestor', () => {
const ScrollView = createReactNativeComponentClass('RCTScrollView', () => ({
validAttributes: {},
uiViewClassName: 'RCTScrollView',
Expand All @@ -683,7 +683,7 @@ describe('ReactFabric', () => {
act(() => {
ReactFabric.render(<View>this should warn</View>, 11);
});
}).toThrow('Text strings must be rendered within a <Text> component.');
}).toErrorDev(['Text strings must be rendered within a <Text> component.']);

expect(() => {
act(() => {
Expand All @@ -694,7 +694,7 @@ describe('ReactFabric', () => {
11,
);
});
}).toThrow('Text strings must be rendered within a <Text> component.');
}).toErrorDev(['Text strings must be rendered within a <Text> component.']);
});

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