Skip to content

Commit

Permalink
RN: Consistently Throw for <Text><View /></Text>
Browse files Browse the repository at this point in the history
Reviewed By: sahrens

Differential Revision: D7898238

fbshipit-source-id: a2b74e691a116b1beae3c6bb266252a722aacbb1
  • Loading branch information
yungsters authored and facebook-github-bot committed May 9, 2018
1 parent 3e534b9 commit 6a1b416
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
5 changes: 2 additions & 3 deletions Libraries/Components/View/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ if (__DEV__) {
ViewToExport = React.forwardRef((props, ref) => (
<TextAncestor.Consumer>
{hasTextAncestor => {
// TODO: Change iOS to behave the same as Android.
invariant(
!hasTextAncestor || Platform.OS !== 'android',
'Nesting of <View> within <Text> is not supported on Android.',
!hasTextAncestor,
'Nesting of <View> within <Text> is not currently supported.',
);
return <RCTView {...props} ref={ref} />;
}}
Expand Down
8 changes: 0 additions & 8 deletions RNTester/js/TextInputExample.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,14 +872,6 @@ exports.examples = [
style={styles.multiline}
dataDetectorTypes="phoneNumber"
/>
<TextInput
placeholder="multiline with children"
multiline={true}
enablesReturnKeyAutomatically={true}
returnKeyType="go"
style={styles.multiline}>
<View style={styles.multilineChild}/>
</TextInput>
</View>
);
}
Expand Down

3 comments on commit 6a1b416

@mpyw
Copy link

@mpyw mpyw commented on 6a1b416 Nov 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aleclarson
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yungsters @shergin Didn't 2716f53 add support for nesting View components within Text components?

@shergin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! This PR is actually reverts this changes:
#23195

I hope we can land it soon.

Please sign in to comment.