Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 在视图的右侧以弧形向内弯曲_React Native - Fatal编程技术网

React native 在视图的右侧以弧形向内弯曲

React native 在视图的右侧以弧形向内弯曲,react-native,React Native,我想使用react native为我手机中的菜单制作打开/关闭动画。但我不知道如何使视图的一侧像想法中那样弯曲。 我尝试使用SVG,但无法将其存档。 我尝试使用边界半径,但似乎不起作用,无法在(关闭菜单时)动画中绘制曲线 <View style={styles.container}> <View style={{ width:200, flex:1, backgroundColor:"red", bor

我想使用react native为我手机中的菜单制作打开/关闭动画。但我不知道如何使视图的一侧像想法中那样弯曲。 我尝试使用SVG,但无法将其存档。
我尝试使用边界半径,但似乎不起作用,无法在(关闭菜单时)动画中绘制曲线

<View style={styles.container}>
      <View style={{
        width:200,
        flex:1,
        backgroundColor:"red",
        borderTopRightRadius:400,
        borderBottomRightRadius: 400,
      }}>
      </View>

    </View>

我想让它像这样工作:
谢谢

我在React Native中做了大量的动画,但那一个看起来相当棘手。不过,我想我有一个解决办法。(思考了大约20分钟后)

我将给出一个示例场景:菜单位于主屏幕的顶部,您向左滑动以使用动画中的曲线关闭菜单

1) 创建具有以下样式的动画视图:

const { width, height } = Dimensions.get('window');

const styles = StyleSheet.create({
  container: {
    position: 'absolute',
    top: -height,
    left: width,
    width: height * 3,
    height: height * 3,
    borderRadius: height * 1.5
  }
});
2) 将动画视图的背景色更改为主屏幕的背景色

3) 创建一个动画.Value并将transform:[{scale}]属性调整为大约1.1

这将使动画视图放大,从右侧取整其边框,使其看起来像菜单中的曲线

您可能需要使用边界半径和高度。但从理论上讲,这应该是可行的

4) 将菜单设置为左侧动画,并将动画视图缩放回1.0

下面是一个示例图像,可以解释我的意思: