有没有人找到在 Android 上的 React Native 中嵌套视图的解决方法? [英] Has anyone found a workaround for nesting views in React Native on Android?

查看:44
本文介绍了有没有人找到在 Android 上的 React Native 中嵌套视图的解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Hey I was wondering if there was some kind of workaround for nesting views on React Native on android, it seems that things like

class BlueIsCool 扩展组件 {使成为() {返回 (<文字>有一个蓝色方块<视图样式={{width: 50, height: 50, backgroundColor: 'steelblue'}}/>在我的文字之间.</文本>);}}

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

is not possible on Android. Is there any way to do something like this on Android using React Native?

推荐答案

你可以这样做

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

这篇关于有没有人找到在 Android 上的 React Native 中嵌套视图的解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆