我目前正在进行一个设计项目,并面临着实现特定曲线效果的挑战.我附上两张图片供参考:

The Desired Design:

My Current Progress:

正如你所看到的,我已经成功地创建了一个基本的 struct ,但我正在努力从左侧向内弯曲视图的中心,如第一张图所示.我试过各种方法,但似乎没有一种能产生预期的效果.

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

    const ProfieTopCard = () => {
        return (
        <View
          style={{
           flexDirection: 'row',
           backgroundColor: 'green',
           height: '45%',
           justifyContent: 'center',
           alignItems: 'center',
           overflow: 'hidden',
           }}>
             <View
            style={{
            flexDirection: 'column',
              width: '25%',
             height: '100%',
             justifyContent: 'center',
             alignItems: 'center',
                //   backgroundColor: 'red',
             }}>
            <Image
             source={require('../../assets/test.png')}
              resizeMode="stretch"
              style={{height: '85%', width: '85%', borderRadius: 50}}
               />      
                  </View>
                 <View
                  style={{
                    flexDirection: 'column',
                      backgroundColor: '#fff',
                   borderTopRightRadius: 30,
                   borderBottomRightRadius: 30,

          width: '70%',
          height: '85%',
          alignItems: 'center',
          justifyContent: 'center',
        }}>
        <View
          style={{
            flexDirection: 'row',
            height: '100%',
            width: '100%',
            // backgroundColor: 'red',
          }}>
          <View
            style={{
              flexDirection: 'column',
              width: '80%',
              justifyContent: 'center',
            }}>
            <Text>hello</Text>
          </View>
          <View
            style={{
              flexDirection: 'column',
              width: '20%',
              justifyContent: 'center',
            }}>
            <Text>hello</Text>
          </View>
        </View>
      </View>
    </View>
  );
};

export default ProfieTopCard;

const styles = StyleSheet.create({});`

推荐答案

你可以这样做

import { Text, View, Image } from 'react-native';

const img = 'https://letsenhance.io/static/66c1b6abf8f7cf44c19185254d7adb0c/28ebd/AiArtBefore.jpg';

export default function App() {
  return (
    <View style={{ flex: 1, justifyContent: 'center',backgroundColor: '#1E9E64',padding: 8}}>
      <View
        style={{ flexDirection: 'row', backgroundColor: '#fff', alignItems: 'center', marginHorizontal: '2%', borderRadius: 20, height: 60}}>
        <View
          style={{ borderRadius: 150, borderWidth: 10, marginHorizontal: 15, overflow: 'hidden', borderColor:'#1E9E64'}}>
          <Image
            source={{ uri: img }}
            style={{ width: undefined, height: 60, aspectRatio: 1 }}
          />
        </View>
        <View
          style={{ marginHorizontal: '5%'}}>
          <Text>this the title</Text>
          <Text>this the body</Text>
        </View>
      </View>
    </View>
  );
}
 

Edit: Here is how it looks.enter image description here

Javascript相关问答推荐

为什么getRecord()会因为与_logger相关的错误而失败?(使用Hedera SDK)

从实时数据库(Firebase)上的子类别读取数据

togglePopover()不打开但不关闭原生HTML popover'

Angular material 拖放堆叠的牌副,悬停时自动展开&

为什么promise对js中的错误有一个奇怪的优先级?

如何通过将实例方法的名称传递给具有正确类型的参数的继承方法来调用实例方法?

Next.js服务器端组件请求,如何发送我的cookie token?

类构造函数不能在没有用With Router包装的情况下调用

元素字符串长度html

MarkLogic-earch.suggest不返回任何值

AddEventListner,按键事件不工作

判断函数参数的类型

如何让SVG图标在被点击和访问后改变 colored颜色 ,并在被访问后取消点击时恢复到原来的 colored颜色 ?

按特定顺序将4个数组组合在一起,按ID分组

为什么我的SoupRequest";被重置为初始值,以及如何修复它?

我在哪里添加过滤器值到这个函数?

设置复选框根据选中状态输入选中值

JSX/React -如何在组件props 中循环遍历数组

在此div中添加一个类,并在一段时间后在Java脚本中将其删除

使用重新 Select 和对象理解 Select 器备忘