有没有人找到在 Android 上的 React Native 中嵌套视图的解决方法?

IT技术 android reactjs react-native
2021-05-08 06:01:57

嘿,我想知道是否有某种解决方法可以在 android 上的 React Native 上嵌套视图,看起来像

class BlueIsCool extends Component { render() { return ( <Text> There is a blue square <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} /> in between my text. </Text> ); } }

在 Android 上是不可能的。有没有办法在 Android 上使用 React Native 做这样的事情?

1个回答

你可以简单地做

<View>
    <Text>
        There is a blue square
    </Text>
    <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
    <Text>
        in between my text.
    </Text>
</View>