子视图覆盖父视图的边界。 [反应天然]

问题描述 投票:3回答:1

我正在尝试按照本地反应做。我在父视图中设置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

有什么我想要添加的吗?

javascript reactjs react-native react-native-android react-native-ios
1个回答
8
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.