带有边界半径的溢出在本机反应中不能正常工作

Overflow with border-radius does not work correctly in react-native

我已经执行了以下操作,但 overflow: hidden 不起作用。 border-radius 应该像墙一样工作。

const App = () => {
  return (
    <View style={styles.container} >
      <View style={styles.itemContainer}>
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
        <View style={styles.item} />
      </View>
    </View>
  );
};


const styles = StyleSheet.create({
  container: {
    position: "absolute", top: 200, right: 20, width: 200, height: 200, borderColor: "red", borderWidth: 1, backgroundColor: "#ff0", borderBottomEndRadius: 200
  },
  itemContainer: {
    flexDirection: "row", flexWrap: "wrap", overflow: "hidden"
  },
  item: {
    width: 30, height: 30, borderRadius: 15, backgroundColor: "#000", margin: 10,
  },
});

圆圈不应超出边界半径。 我该怎么做?

如有任何帮助,我们将不胜感激。

您需要更改 container 样式和 itemContainer

    const App = () => {
      return (
        <View style={styles.container} >
          <View style={styles.itemContainer}>
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
            <View style={styles.item} />
          </View>
        </View>
      );
    };
    
    

const styles = StyleSheet.create({
  container: {
    flex: 1,
    paddingTop: 20,
    backgroundColor: '#fff',
    justifyContent: 'center',
    alignItems: 'center',
  },
  itemContainer: {
    position: 'absolute',
    top: 200,
    right: 20,
    width: 200,
    height: 200,
    borderColor: 'red',
    borderWidth: 1,
    backgroundColor: '#ff0',
    borderBottomEndRadius: 200,
    flexDirection: 'row',
    flexWrap: 'wrap',
    overflow: 'hidden',
  },
  item: {
    width: 30,
    height: 30,
    borderRadius: 15,
    backgroundColor: '#000',
    margin: 10,
  },
});