RN: Consistently Throw for <Text><View /></Text>

Reviewed By: sahrens

Differential Revision: D7898238

fbshipit-source-id: a2b74e691a116b1beae3c6bb266252a722aacbb1
This commit is contained in:
Tim Yung 2018-05-09 00:47:50 -07:00 committed by Facebook Github Bot
parent 3e534b9aab
commit 6a1b41643a
2 changed files with 2 additions and 11 deletions

View File

@ -63,10 +63,9 @@ if (__DEV__) {
ViewToExport = React.forwardRef((props, ref) => ( ViewToExport = React.forwardRef((props, ref) => (
<TextAncestor.Consumer> <TextAncestor.Consumer>
{hasTextAncestor => { {hasTextAncestor => {
// TODO: Change iOS to behave the same as Android.
invariant( invariant(
!hasTextAncestor || Platform.OS !== 'android', !hasTextAncestor,
'Nesting of <View> within <Text> is not supported on Android.', 'Nesting of <View> within <Text> is not currently supported.',
); );
return <RCTView {...props} ref={ref} />; return <RCTView {...props} ref={ref} />;
}} }}

View File

@ -872,14 +872,6 @@ exports.examples = [
style={styles.multiline} style={styles.multiline}
dataDetectorTypes="phoneNumber" dataDetectorTypes="phoneNumber"
/> />
<TextInput
placeholder="multiline with children"
multiline={true}
enablesReturnKeyAutomatically={true}
returnKeyType="go"
style={styles.multiline}>
<View style={styles.multilineChild}/>
</TextInput>
</View> </View>
); );
} }