css - 在 React Native 中将按钮设置在位置 "fixed"

标签 css react-native

我想在 React Native 中的右下角宽度固定位置设置按钮。

position: fixed 在 React Native 中不起作用,并且 ScrollView 中的 stickyHeaderIndices 方法不允许将元素定位在其他组件之上。

有人已经测试过这个功能吗?

最佳答案

试试这个:

render() {
    return (
      <View style={{flex:1}}>
        <View style={{borderWidth:1,position:'absolute',bottom:0,alignSelf:'flex-end'}}>
           <Button
             title="Press"
             color="#841584"
             accessibilityLabel="Press"/>
        </View>
      </View>
    );
  }

输出:

enter image description here

关于css - 在 React Native 中将按钮设置在位置 "fixed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48188126/

相关文章:

javascript - 垂直居中的 CSS3 方法

html - 段落不使用左边距移动

react-native - 使用 setState 时不会加载图像 URI

javascript - 获取我的li所在的ul的id

jquery - 悬停时隐藏CSS下拉菜单

jquery - Bootstrap 轮播在 Shopify 中的最后一张幻灯片后停止

android - React Native 通用 apk 立即崩溃

javascript - 如何在 React Native 中动态包含模块

ios - 从终端运行 React Native iOS 发布版本

javascript - 将一个对象分配给另一个不带所有字段的对象