react-native - 如何制作倒置的边框半径( react native )?

标签 react-native flexbox

我怎么能在 react-native 中做这样的形状?

在 CSS 中,解决方案之一是使用 -webkit-mask-image,但我不知道如何在 react-native 中使用它。

Inverted border radius

最佳答案

其实是CSS,不是ract-native。 :).

下面是我的技巧,你可以调整精确值。

.square-wrapper {
  position: relative;
  height: 100px;
  width: 100px;
  overflow: hidden;
}

.square {
  height: 100%;
  width: 100%;
  background: grey;
  border: 2px solid red;
  border-radius: 10px;
  box-sizing: border-box;
}

.square:after {
  position: absolute;
  display: block;
  content: '';
  right: -50%;
  bottom: -50%;
  height: 100%;
  width: 100%;
  background: white;
  border-top: 2px solid red;
  border-left: 2px solid red;
  border-radius: 50%;
}
<div class="square-wrapper">
  <div class="square"></div>
</div>

关于react-native - 如何制作倒置的边框半径( react native )?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51140427/

相关文章:

android - Android 上的 React Native Facebook SDK 初始化

javascript - React Native 从任意数据创建 blob

html - 如果引入了新容器,则打破 flexbox

javascript - react native 运行 ios 构建失败,因为 'LogSeverity'

React-Native Realm 通过主键获取

ios - 如何解决 metro bundler 的 "dead lock"情况 - 提示命名冲突或无法解析模块

html - 两个 div 动态填充视口(viewport)高度

css - 新版谷歌浏览器css显示: flex issue

html - CSS:使 Flexbox 布局静态化

angularjs - 使用带有智能表格 Angular 的固定标题使表格 100%