有没有可能知道视图是否被包装 [英] is there any possibility to know if the View is wrapped
本文介绍了有没有可能知道视图是否被包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 View
如下
<View style={{width: '60%', flexDirection: 'row', flexWrap: 'wrap'}}>
{ .....}
{ .....}
<View>
如果 View
中的项目能够在单行中呈现,否则 View
会相应地扩展到第二行.
if the items in the View
are able to be rendered in the single line other wise View
will be expanded to second line accordingly.
我的疑问是,有什么办法以编程方式知道 View
是否已包装?
Here my doubt is , Is there any way to know programatically that View
is wrapped?
推荐答案
您可以创建对View的引用,并在其属性中检查其样式.在此处查看如何创建元素引用 https://reactjs.org/docs/refs-and-the-dom.html
You can create reference to View and check its styles in its properties. Check here for how to create element reference https://reactjs.org/docs/refs-and-the-dom.html
这篇关于有没有可能知道视图是否被包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文