简体   繁体   English

React Native:由于溢出=在Android上隐藏,我们如何设计浮动操作按钮

[英]React Native: as overflow = hidden on Android, how can we design floating action button

As mentioned in the documentation , on Android overflow is set to hidden and cannot be changed. 文档中所述,Android上的溢出设置为隐藏且无法更改。 Hence this raises this kind of problems . 因此,这就产生了这类问题 My question is how can we make floating action buttons with react native. 我的问题是我们如何才能使浮动动作按钮具有原生响应功能。 I want to have a button like this itinerary button of Google Maps. 我想要一个类似Google Maps行程按钮的按钮。 It should be somehow linked to the Empire state building view as it will move synchronously with it if the latter is dragged. 它应该以某种方式链接到“帝国大厦”视图,因为如果拖动它,它将与之同步移动。

I see different ways to make it work but none of them feels good as they either create invisible views or need to propagate many props. 我看到了使其工作的不同方法,但是它们都不是很好,因为它们要么创建不可见的视图,要么需要传播许多道具。 Is there a common trick people are used to? 人们习惯了一种常见的技巧吗?

屏幕截图

The easiest way to create a floating button would be to utilize these in your styles for the button: 创建浮动按钮的最简单方法是在您的样式中使用以下按钮:

position: 'absolute',
bottom: 20,
right: 20

Or however you want it positioned. 或者,但是您希望它定位。 That will keep it on the lower right hand corner of the screen. 这样会将其保留在屏幕的右下角。

Also I'd recommend checking out a library like this one: https://github.com/mastermoo/react-native-action-button 我也建议您检查像这样的库: https : //github.com/mastermoo/react-native-action-button

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM