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
5 changes: 0 additions & 5 deletions packages/react-native-renderer/src/ReactFabricHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ export function createInstance(
}
}

invariant(
type !== 'RCTView' || !hostContext.isInAParentText,
'Nesting of <View> within <Text> is not currently supported.',
);

const updatePayload = create(props, viewConfig.validAttributes);

const node = createNode(
Expand Down
5 changes: 0 additions & 5 deletions packages/react-native-renderer/src/ReactNativeHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ export function createInstance(
}
}

invariant(
type !== 'RCTView' || !hostContext.isInAParentText,
'Nesting of <View> within <Text> is not currently supported.',
);

const updatePayload = create(props, viewConfig.validAttributes);

UIManager.createView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ describe('ReactFabric', () => {
expect(snapshots).toMatchSnapshot();
});

it('should throw when <View> is used inside of a <Text> ancestor', () => {
it('should not throw when <View> is used inside of a <Text> ancestor', () => {
const Image = createReactNativeComponentClass('RCTImage', () => ({
validAttributes: {},
uiViewClassName: 'RCTImage',
Expand All @@ -624,16 +624,13 @@ describe('ReactFabric', () => {
uiViewClassName: 'RCTView',
}));

expect(() =>
ReactFabric.render(
<Text>
<View />
</Text>,
11,
),
).toThrow('Nesting of <View> within <Text> is not currently supported.');
ReactFabric.render(
<Text>
<View />
</Text>,
11,
);

// Non-View things (e.g. Image) are fine
ReactFabric.render(
<Text>
<Image />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ describe('ReactNative', () => {
expect(mockArgs.length).toEqual(0);
});

it('should throw when <View> is used inside of a <Text> ancestor', () => {
it('should not throw when <View> is used inside of a <Text> ancestor', () => {
const Image = createReactNativeComponentClass('RCTImage', () => ({
validAttributes: {},
uiViewClassName: 'RCTImage',
Expand All @@ -500,14 +500,12 @@ describe('ReactNative', () => {
uiViewClassName: 'RCTView',
}));

expect(() =>
ReactNative.render(
<Text>
<View />
</Text>,
11,
),
).toThrow('Nesting of <View> within <Text> is not currently supported.');
ReactNative.render(
<Text>
<View />
</Text>,
11,
);

// Non-View things (e.g. Image) are fine
ReactNative.render(
Expand Down