Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.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无法达到我想要的borderRadius结果_React Native_React Native Stylesheet - Fatal编程技术网

React native react native无法达到我想要的borderRadius结果

React native react native无法达到我想要的borderRadius结果,react-native,react-native-stylesheet,React Native,React Native Stylesheet,大家好,我尝试添加两个心形图标,如图所示: 我尝试制作这些组件: <View style={styles.buttonContainer}> <View style={styles.xButton} /> <View style={styles.heartButton} /> </View> 我在手机中得到的结果: 我正在使用figma进行设计,也许我应该导出所有项目并像图片一样添加它?我想这样的东

大家好,我尝试添加两个心形图标,如图所示:

我尝试制作这些组件:

<View style={styles.buttonContainer}>
        <View style={styles.xButton} />
        <View style={styles.heartButton} />
      </View>
我在手机中得到的结果:


我正在使用figma进行设计,也许我应该导出所有项目并像图片一样添加它?

我想这样的东西会给你的形状()

在渲染中:

  <View style={styles.topFlag} />
  <View style={styles.centerFlag} />
  <View style={styles.bottomFlag} />

你可以从

中获得灵感,我想这样的东西会让你的身材()

在渲染中:

  <View style={styles.topFlag} />
  <View style={styles.centerFlag} />
  <View style={styles.bottomFlag} />

你可以在

中获得灵感。你可以创建一个具有特定边界半径的视图,并以如下所示的角度对其进行变换

import React, {Component} from 'react';
import {View, StyleSheet} from 'react-native';

const styles = StyleSheet.create({
  my_component: {
    width: 110,
    height: 110,
    position: 'absolute',
    backgroundColor: 'black',
    borderStyle: 'solid',
    borderLeftColor: 'transparent',
    borderTopStartRadius: 45,
    borderRightColor: 'transparent',
    borderBottomColor: 'red',
    top: '40%',
    transform: [{rotate: '135deg'}],
  },
  leftComponent: {
    transform: [{rotate: '135deg'}],
    left: -55,
  },
  rightComponent: {
    transform: [{rotate: '315deg'}],
    right: -55,
  },
});

class Page extends Component {
  render() {
    return (
      <View style={{flex: 1, backgroundColor: '#ffffff'}}>
        <View style={[styles.my_component, styles.leftComponent]} />
        <View style={[styles.my_component, styles.rightComponent]} />
      </View>
    );
  }
}

export default Page;
import React,{Component}来自'React';
从“react native”导入{View,StyleSheet};
const styles=StyleSheet.create({
my_组件:{
宽度:110,
身高:110,
位置:'绝对',
背景颜色:“黑色”,
边框样式:“实心”,
borderLeftColor:'透明',
边界半径:45,
borderRightColor:“透明”,
borderBottomColor:'红色',
前几名:“40%”,
变换:[{rotate:'135deg'}],
},
左组件:{
变换:[{rotate:'135deg'}],
左:-55,
},
右组件:{
变换:[{rotate:'315deg'}],
右:-55,
},
});
类页面扩展组件{
render(){
返回(
);
}
}
导出默认页面;
该位置设置为绝对。取得的成果如下:

我没有添加任何图标,但图标也必须使用位置:'absolute'进行定位,并相应地移动它们


我相信结果最接近您想要达到的效果。

您可以创建一个具有特定边界半径的视图,并以如下所示的角度对其进行变换

import React, {Component} from 'react';
import {View, StyleSheet} from 'react-native';

const styles = StyleSheet.create({
  my_component: {
    width: 110,
    height: 110,
    position: 'absolute',
    backgroundColor: 'black',
    borderStyle: 'solid',
    borderLeftColor: 'transparent',
    borderTopStartRadius: 45,
    borderRightColor: 'transparent',
    borderBottomColor: 'red',
    top: '40%',
    transform: [{rotate: '135deg'}],
  },
  leftComponent: {
    transform: [{rotate: '135deg'}],
    left: -55,
  },
  rightComponent: {
    transform: [{rotate: '315deg'}],
    right: -55,
  },
});

class Page extends Component {
  render() {
    return (
      <View style={{flex: 1, backgroundColor: '#ffffff'}}>
        <View style={[styles.my_component, styles.leftComponent]} />
        <View style={[styles.my_component, styles.rightComponent]} />
      </View>
    );
  }
}

export default Page;
import React,{Component}来自'React';
从“react native”导入{View,StyleSheet};
const styles=StyleSheet.create({
my_组件:{
宽度:110,
身高:110,
位置:'绝对',
背景颜色:“黑色”,
边框样式:“实心”,
borderLeftColor:'透明',
边界半径:45,
borderRightColor:“透明”,
borderBottomColor:'红色',
前几名:“40%”,
变换:[{rotate:'135deg'}],
},
左组件:{
变换:[{rotate:'135deg'}],
左:-55,
},
右组件:{
变换:[{rotate:'315deg'}],
右:-55,
},
});
类页面扩展组件{
render(){
返回(
);
}
}
导出默认页面;
该位置设置为绝对。取得的成果如下:

我没有添加任何图标,但图标也必须使用位置:'absolute'进行定位,并相应地移动它们


我相信结果最接近您试图实现的目标。

是的,我还建议您使用图像而不是为这种类型的曲线设计创建边框。是的,我还建议您使用图像而不是为这种类型的曲线设计创建边框。