在 React Native 中重叠元素样式? [英] Overlapping Elements Style in React Native?

查看:106
本文介绍了在 React Native 中重叠元素样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 React Native 创建重叠元素.

I want to create Overlapping Elements using React Native.

一个例子可以是 Trixie App,如下所示 -

An example can be Trixie App as follows -

我想在 blue & 之间创建一个这样的盒子白色.

I want to create a box like that in-between blue & white color.

可以使用 Flexbox 完成还是需要绝对定位?Bcz 如果我使用绝对定位创建,假设我给它 height:100(蓝色),那么 white 聊天框可能不会出现一半取决于屏幕尺寸,适用于各种设备.

Can it be done using Flexbox or do we need Absolute Positioning ? Bcz if I create using Absolute positioning, lets assume I give it height:100 (the blue color) then the white chat box might not be halfway up & down on various devices depending on their screen dimensions.

还有如何让它在平板电脑等各种设备上响应?

Also how to make it so that its responsive on various devices like Tablets, etc ?

推荐答案

回答我自己的问题.

可以使用position: absolute;顶部:-25; &它必须在内部使用 position: relative.

It can be done using position: absolute; top: -25; & it has to use position: relative in the inside.

我会尽快发布一个链接以完成回购.暂时只回答这么多.回购将在 2 天内提供.

I'll post a link to complete repo soon enough. Answering only this much for now. Repo will be provied in 2 days.

此外,还制作了一个 repo 使其更简单 - https://github.com/entria/react-native-view-overflow

Also, a repo has been made to do it much simpler - https://github.com/entria/react-native-view-overflow

这篇关于在 React Native 中重叠元素样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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