子视图将覆盖父视图的边界。 [react-native]

时间:2018-08-29 16:11:43

标签: javascript reactjs react-native react-native-android react-native-ios

我试图在react-native中执行以下操作。 我在父视图中设置了borderRadius。但是孩子对此很无礼。因此,在最终视图中,borderRadius不可见

export default class FlexDimensionsBasics extends Component {
  render() {
    return (
      // Try removing the `flex: 1` on the parent View.
      // The parent will not have dimensions, so the children can't expand.
      // What if you add `height: 300` instead of `flex: 1`?
      <View style={{flex: 1, borderRadius:30, backgroundColor:'red'}}>
        <View style={{flexGrow: 10, backgroundColor: 'powderblue'}} />
        <View style={{flexGrow: 20, backgroundColor: 'skyblue'}} />
        <View style={{flexGrow: 30, backgroundColor: 'steelblue'}} />
      </View>
    );
  }
}

enter image description here

我想补充什么吗?

1 个答案:

答案 0 :(得分:8)

overflow: "hidden"添加到您的父级样式

相关问题